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}
| ... | ... |
| ... | ... |