|
From: | Thomas S. Dye |
Subject: | Re: [Orgmode] Are there better ways to export wide LaTeX tables/figures? |
Date: | Thu, 9 Dec 2010 07:16:15 -1000 |
Aloha Kai, I've just pushed one solution to the problem of wide tables up to http://orgmode.org/worg/org-tutorials/org-latex-export.php. Here it is for your convenience: The LaTeX exporter is currently able to export tabular and longtable environments. In situations where the width of the table needs to be specified, the tabularx package is a good solution, but this isn't supported by the exporter. You can get the tabularx environment with the proper setup and calling a handy function in the Library of Babel. First, load the tabularx and booktabs packages: =#+LATEX_HEADER: \usepackage{tabularx,booktabs}= Then, give your table a name, e.g., =#+tblname: test-table= and put it somewhere the LaTeX exporter won't see. Finally, create a LaTeX source block something like this: : #+source: tabularx-export : #+begin_src latex :exports results :results latex : \begin{table}[htb!] : \centering : \footnotesize : \caption{A table to test the tabularx environment} : \label{tab:test-table} : <<booktabs(table=test-table,align="lX",env="tabularx",width="\\textwidth")>> : \end{table} : #+end_src When you export the file to LaTeX, this code block is expanded in a =#+results:= block and wrapped in =#+BEGIN_LaTeX= ... =#+END_LaTeX=. The booktabs function does most of the work. The X alignment in the example is defined by tabularx to calculate the width of the column automatically and then wrap its contents. This works well in most cases, but you might need to define a column type that sets the contents ragged right, something like this: \newcolumntype{Y}{>{\raggedright\arraybackslash}X} This requires the array package, so you might need a line like this, too: LaTex_HEADER: \usepackage{array} hth, Tom On Dec 8, 2010, at 4:08 PM, Kai wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |