PDF Engines

Overview

Pandoc supports the use of a wide range of TeX distributions and PDF compilation engines including pdflatex, xelatex, lualatex, tectonic, and latexmk.

While you can employ whatever toolchain you like for LaTeX compilation, we strongly recommend the use of TinyTeX, which is a distribution of TeX Live that provides a reasonably sized initial download (~100 MB) that includes the 200 or so most commonly used TeX packages for Pandoc documents.

We also recommend the use of Quarto’s built in PDF compilation engine, which among other things performs automatic installation of any missing TeX packages.

Installing TeX

To install TinyTeX, use the following command:

quarto tools install tinytex

If you prefer TeX Live, you can find instructions for installing it here: https://tug.org/texlive/.

Note that Quarto’s automatic installation of missing TeX packages will work for TinyTeX and TeX Live, but not for other TeX distributions (as it relies on TeX Live’s tlmgr command).

Quarto PDF Engine

Quarto’s built-in PDF compilation engine handles running LaTeX multiple times to resolve index and bibliography entries, and also performs automatic LaTeX package installation. This section describes customizing the built-in engine (see the Alternate PDF Engines section below for docs on using other engines).

PDF Compilation

The following options are available for customizing PDF compilation:

Option Description
latex-min-runs Number (minimum number of compilation passes)
latex-max-runs Number (maximum number of compilation passes)
latex-clean Boolean (clean intermediates after compilation, defaults to true)
latex-output-dir String (output directory for intermediates and PDF)
latex-makeindex String (program to use for makeindex)
latex-makeindex-opts Array (options for makeindexprogram)

Package Installation

The following options are available for customizing automatic package installation:

Option Description
latex-auto-install Boolean (enable/disable automatic package installation)
latex-tlmgr-opts Array (options for tlmgr)

Alternate PDF Engines

You can use the pdf-engine and pdf-engine-opts to control the PDF engine that Quarto uses to compile the LaTeX output into a PDF. For example:

title: "My Document"
pdf-engine: lualatex
pdf-engine-opt: -outdir=out

The above example will use the lualatex PDF engine rather than the default xelatex.

Latexmk

Quarto includes a built in Latexmk engine, which will run the pdf-engine more than once to generate your PDF (for example if you’re using cross references or a bibliography). In addition, this engine will detect and attempt to install missing packages, fonts, or commands if TeX Live is available.

You can disable Quarto’s built in Latexmk engine by settng the latex-auto-mk option to false. For example:

title: "My Document"
latex-auto-mk: false