13.10.3 LaTeX header and sectioning structure

The LaTeX export back-end converts the first three of Org’s outline levels into LaTeX headlines. The remaining Org levels are exported as lists. To change this globally for the cut-off point between levels and lists, (see Export Settings).

By default, the LaTeX export back-end uses the article class.

To change the default class globally, edit org-latex-default-class. To change the default class locally in an Org file, add option lines ‘#+LATEX_CLASS: myclass’. To change the default class for just a part of the Org file, set a subtree property, ‘EXPORT_LATEX_CLASS’. The class name entered here must be valid member of org-latex-classes. This variable defines a header template for each class into which the exporter splices the values of org-latex-default-packages-alist and org-latex-packages-alist. Use the same three variables to define custom sectioning or custom classes.

The LaTeX export back-end sends the ‘LATEX_CLASS_OPTIONS’ keyword and ‘EXPORT_LATEX_CLASS_OPTIONS’ property as options to the LaTeX \documentclass macro. The options and the syntax for specifying them, including enclosing them in square brackets, follow LaTeX conventions.

#+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]

The LaTeX export back-end appends values from ‘LATEX_HEADER’ and ‘LATEX_HEADER_EXTRA’ keywords to the LaTeX header. The docstring for org-latex-classes explains in more detail. Also note that LaTeX export back-end does not append ‘LATEX_HEADER_EXTRA’ to the header when previewing LaTeX snippets (see Previewing LaTeX fragments).

A sample Org file with the above headers:

#+LATEX_CLASS: article
#+LATEX_HEADER: \usepackage{xyz}

* Headline 1
  some text
* Headline 2
  some more text

LaTeX packages ‘babel’ or ‘polyglossia’ can also be loaded in a document. The “AUTO” string will be replaced in both cases by the appropriate value for the ‘LANGUAGE’ keyword, if present in the document, or by the value of org-export-default-language. Let’s see some examples in one or another case.

Babel’ accepts the classic syntax and (in addition) the new syntax with the ‘\babelprovide’ command to load the languages using the new ‘INI’ files procedure. Keep in mind that there are a number of languages that are only served in babel using ‘INI’ files, so they cannot be declared using the classic syntax, but only using the ‘\babelprovide’ command (see https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf). Valid usage examples could be:

#+LATEX_HEADER: \usepackage[french,italian,AUTO]{babel}

where “AUTO” is the main language. But it can also be loaded using the ‘\babelprovide’ command:

#+LATEX_HEADER: \usepackage[french,italian]{babel}
#+LATEX_HEADER: \babelprovide[import, main]{AUTO}

Polyglossia’, for this procedure to be effective, must be loaded using the same ‘babel’ classic syntax (but note that this is not the actual polyglossia syntax). For example, suppose a document declares Polytonic Greek as the primary language, and French as the secondary language. In this case, it would be expressed as:

#+LANGUAGE: el-polyton
#+LATEX_HEADER: \usepackage[french,AUTO]{polyglossia}

This would produce in LaTeX (with the actual ‘polyglossia’ syntax):