In addition to the default native HTML output, Documenter also provides a built-in LaTeX-based PDF output. Additional output formats are provided through plugin packages. Once the corresponding package is loaded, the output format can be specified using the
format option in
makedocs can be switched over to use the PDF/LaTeX backend by passing a
Documenter.LaTeX object as the
makedocs(format = Documenter.LaTeX(), ...)
Documenter will then generate a PDF file of the documentation using LaTeX, which will be placed in the output (
sitename will be used for the
\title field in the tex document, and if the build is for a release tag (i.e. when the
"TRAVIS_TAG" environment variable is set) the version number will be appended to the title. The
authors should also be specified, it will be used for the
\authors field in the tex document.
pages is not assigned, Documenter will generate tex documents without contents. (#2132)
The following is required to build the documentation:
- You need
latexmkcommands to be installed and available to Documenter.
- You need the minted LaTeX package and its backend source highlighter Pygments installed.
- You need the DejaVu Sans and DejaVu Sans Mono fonts installed.
The documentation can be also built using the Tectonic LaTeX engine. It is required to have a
tectonic available in
PATH, or to provide a path to the binary using the
# Executable `tectonic` is present in `PATH`
format = Documenter.LaTeX(platform="tectonic"),
# The path to `tectonic` is provided by the tectonic_jll package
using tectonic_jll: tectonic
format = Documenter.LaTeX(platform="tectonic", tectonic=tectonic()),
It is also possible to use a prebuilt docker image to compile the
.tex file. The image contains all of the required installs described in the section above. The only requirement for using the image is that
docker is installed and available for the builder to call. You also need to tell Documenter to use the docker image, instead of natively installed tex which is the default. This is done with the
format = LaTeX(platform = "docker"),
If you build the documentation on Travis you need to add
There's a possibility to save only the
.tex file and skip the PDF compilation. For this purpose use the
format = LaTeX(platform = "none"),
The PDF/LaTeX backend works by generating a TeX file based on the input Markdown files. For users who need or want more control over the generated PDF, it is possible to customize the setup part of the generated TeX code.
By default, the generated TeX file loads the
documenter.sty style file, which loads several packages (such as
graphicx) and otherwise configures the TeX build.
Users can load additional packages and declare additional configuration by adding a
custom.sty file to the
assets/ source directory. The custom style file will be loaded right after the default style (
By default, Documenter uses the
preamble.tex preamble, with only the dynamically generated declarations for the
\JuliaVersion variables preceding it.
For more control, it is possible to fully replace the preamble by adding a
preamble.tex file into the
assets/ source directory, which will then be used instead of the default one. The Documenter tests contain two examples of how a custom preamble can be used:
Documenter no longer provides the Markdown/MkDocs output, and this functionality has moved to the