Next: , Previous: , Up: LaTeX Export   [Contents][Index]


13.10.5 Tables in LaTeX export

The LaTeX export back-end can pass several LaTeX attributes for table contents and layout. Besides specifying a label (see Internal Links) and a caption (see Captions), the other valid LaTeX attributes include:

:mode

The LaTeX export back-end wraps the table differently depending on the mode for accurate rendering of math symbols. Mode is either ‘table’, ‘math’, ‘inline-math’ or ‘verbatim’.

For ‘math’ or ‘inline-math’ mode, LaTeX export back-end wraps the table in a math environment, but every cell in it is exported as-is. The LaTeX export back-end determines the default mode from org-latex-default-table-mode. The LaTeX export back-end merges contiguous tables in the same mode into a single environment.

:environment

Set the default LaTeX table environment for the LaTeX export back-end to use when exporting Org tables. Common LaTeX table environments are provided by these packages: tabularx, longtable, array, tabu, and bmatrix. For packages, such as tabularx and tabu, or any newer replacements, include them in the org-latex-packages-alist variable so the LaTeX export back-end can insert the appropriate load package headers in the converted LaTeX file. Look in the docstring for the org-latex-packages-alist variable for configuring these packages for LaTeX snippet previews, if any.

:caption

Use ‘CAPTION’ keyword to set a simple caption for a table (see Captions). For custom captions, use ‘:caption’ attribute, which accepts raw LaTeX code. ‘:caption’ value overrides ‘CAPTION’ value.

:float
:placement

The table environments by default are not floats in LaTeX. To make them floating objects use ‘:float’ with one of the following options: ‘sideways’, ‘multicolumn’, ‘t’, and ‘nil’.

LaTeX floats can also have additional layout ‘:placement’ attributes. These are the usual ‘[h t b p ! H]’ permissions specified in square brackets. Note that for ‘:float sideways’ tables, the LaTeX export back-end ignores ‘:placement’ attributes.

:align
:font
:width

The LaTeX export back-end uses these attributes for regular tables to set their alignments, fonts, and widths.

:spread

When ‘:spread’ is non-nil, the LaTeX export back-end spreads or shrinks the table by the ‘:width’ for tabu and longtabu environments. ‘:spread’ has no effect if ‘:width’ is not set.

:booktabs
:center
:rmlines

All three commands are toggles. ‘:booktabs’ brings in modern typesetting enhancements to regular tables. The booktabs package has to be loaded through org-latex-packages-alist. ‘:center’ is for centering the table. ‘:rmlines’ removes all but the very first horizontal line made of ASCII characters from “table.el” tables only.

:math-prefix
:math-suffix
:math-arguments

The LaTeX export back-end inserts ‘:math-prefix’ string value in a math environment before the table. The LaTeX export back-end inserts ‘:math-suffix’ string value in a math environment after the table. The LaTeX export back-end inserts ‘:math-arguments’ string value between the macro name and the table’s contents. ‘:math-arguments’ comes in use for matrix macros that require more than one argument, such as ‘qbordermatrix’.

LaTeX table attributes help formatting tables for a wide range of situations, such as matrix product or spanning multiple pages:

#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
| ... | ... |
| ... | ... |

#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
| a | b |
| c | d |
#+ATTR_LATEX: :mode math :environment bmatrix
| 1 | 2 |
| 3 | 4 |

Set the caption with the LaTeX command ‘\bicaption{HeadingA}{HeadingB}’:

#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
| ... | ... |
| ... | ... |

Next: , Previous: , Up: LaTeX Export   [Contents][Index]