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