This is the official manual for the latest Org-mode release.

Table of Contents

Previous: Quoting LaTeX code, Up: LaTeX and PDF export

12.7.5 LaTeX specific attributes

LaTeX understands attributes specified in an ATTR_LATEX line. They affect tables, images, plain lists, source blocks, example blocks and special blocks.

Tables in LaTeX export

For LaTeX export of a table, you can specify a label and a caption (see Images and tables). You can also use attributes to control table layout and contents. Valid LaTeX attributes include:

Nature of table's contents. It can be set to table, math, inline-math or verbatim. In particular, when in math or inline-math mode, every cell is exported as-is, horizontal rules are ignored and the table will be wrapped in a math environment. Also, contiguous tables sharing the same math mode will be wrapped within the same environment. Default mode is determined in org-latex-default-table-mode.
Environment used for the table. It can be set to any LaTeX table environment, like tabularx1, longtable, array, tabu2, bmatrix... It defaults to org-latex-default-table-environment value.
#+CAPTION keyword is the simplest way to set a caption for a table (see Images and tables). If you need more advanced commands for that task, you can use :caption attribute instead. Its value should be raw LaTeX code. It has precedence over #+CAPTION.
The :float specifies the float environment for the table. Possible values are sideways3, multicolumn, t and nil. When unspecified, a table with a caption will have a table environment. Moreover, the :placement attribute can specify the positioning of the float. Note: :placement is ignored for :float sideways tables.
Set, respectively, the alignment string of the table, its font size and its width. They only apply on regular tables.
Boolean specific to the tabu and longtabu environments, and only takes effect when used in conjunction with the :width attribute. When :spread is non-nil, the table will be spread or shrunk by the value of :width.
They toggle, respectively, booktabs usage (assuming the package is properly loaded), table centering and removal of every horizontal rule but the first one (in a "table.el" table only). In particular, org-latex-tables-booktabs (respectively org-latex-tables-centered) activates the first (respectively second) attribute globally.
A string that will be inserted, respectively, before the table within the math environment, after the table within the math environment, and between the macro name and the contents of the table. The :math-arguments attribute is used for matrix macros that require more than one argument (e.g., qbordermatrix).

Thus, attributes can be used in a wide array of situations, like writing a table that will span over multiple pages, or a matrix product:

     #+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 |

In the example below, LaTeX command \bicaption{HeadingA}{HeadingB} will set the caption.

     #+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB}
     | ..... | ..... |
     | ..... | ..... |
Images in LaTeX export

Images that are linked to without a description part in the link, like ‘[[file:img.jpg]]’ or ‘[[./img.jpg]]’ will be inserted into the PDF output file resulting from LaTeX processing. Org will use an \includegraphics macro to insert the image4.

You can specify specify image width or height with, respectively, :width and :height attributes. It is also possible to add any other option with the :options attribute, as shown in the following example:

     #+ATTR_LATEX: :width 5cm :options angle=90

If you need a specific command for the caption, use :caption attribute. It will override standard #+CAPTION value, if any.

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

If you have specified a caption as described in Images and tables, the picture will be wrapped into a figure environment and thus become a floating element. You can also ask Org to export an image as a float without specifying caption by setting the :float attribute. You may also set it to:

To modify the placement option of any floating environment, set the placement attribute.
     #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth}

If the :comment-include attribute is set to a non-nil value, the LaTeX \includegraphics macro will be commented out.

Plain lists in LaTeX export

Plain lists accept two optional attributes: :environment and :options. The first one allows the use of a non-standard environment (e.g., ‘inparaenum’). The second one specifies additional arguments for that environment.

     #+ATTR_LATEX: :environment compactitem :options [$\circ$]
     - you need ``paralist'' package to reproduce this example.
Source blocks in LaTeX export

In addition to syntax defined in Literal examples, names and captions (see Images and tables), source blocks also accept two additional attributes: :float and :options.

You may set the former to

     #+ATTR_LATEX: :float nil
     #+BEGIN_SRC emacs-lisp
     Code that may not fit in a single page.

The latter allows to specify options relative to the package used to highlight code in the output (e.g., listings). This is the local counterpart to org-latex-listings-options and org-latex-minted-options variables, which see.

     #+ATTR_LATEX: :options commentstyle=\bfseries
     #+BEGIN_SRC emacs-lisp
       (defun Fib (n)                          ; Count rabbits.
         (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
Example blocks in LaTeX export

By default, when exporting to LaTeX, example blocks contents are wrapped in a ‘verbatim’ environment. It is possible to use a different environment globally using an appropriate export filter (see Advanced configuration). You can also change this per block using :environment parameter.

     #+ATTR_LATEX: :environment myverbatim
     This sentence is false.
Special blocks in LaTeX export

In LaTeX back-end, special blocks become environments of the same name. Value of :options attribute will be appended as-is to that environment's opening string. For example:

     We demonstrate how to solve the Syracuse problem.
     #+ATTR_LATEX: :options [Proof of important theorem]
     Therefore, any even number greater than 2 is the sum of two primes.


     We demonstrate how to solve the Syracuse problem.
     \begin{proof}[Proof of important theorem]
     Therefore, any even number greater than 2 is the sum of two primes.

If you need to insert a specific caption command, use :caption attribute. It will override standard #+CAPTION value, if any. For example:

     #+ATTR_LATEX: :caption \MyCaption{HeadingA}
Horizontal rules

Width and thickness of a given horizontal rule can be controlled with, respectively, :width and :thickness attributes:

     #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt


[1] Requires adding the tabularx package to org-latex-packages-alist.

[2] Requires adding the tabu package to org-latex-packages-alist.

[3] Formerly, the value was sidewaystable. This is deprecated since Org 8.3.

[4] In the case of TikZ ( images, it will become an \input macro wrapped within a tikzpicture environment.