# Convincing Documenter to create a PDF output

**URL:** <https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337>\
**Category:** Tooling\
**Tags:** documenter\
**Created:** [May 19, 2022, 9:37pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337 "2022-05-19T21:37:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 19, 2022, 9:37pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/1 "2022-05-19T21:37:44Z")

</div>

I’m trying to get Documenter to create a PDF version of my package’s docs. Following the [documentation](https://juliadocs.github.io/Documenter.jl/stable/man/other-formats/), I first tried `makedocs(format = Documenter.LaTeX())`… but quickly realized I no longer have a TeX installation. Duh.

```julia
[ Info: LaTeXWriter: creating the LaTeX file.
┌ Error: LaTeXWriter: latexmk command not found.
└ @ Documenter.Writers.LaTeXWriter ~/.julia/packages/Documenter/tBpqI/src/Writers/LaTeXWriter.jl:180
ERROR: LoadError: Compiling the .tex file failed. See logs for more information.

```

Ah, but the [`tectonic_jll`](https://juliadocs.github.io/Documenter.jl/stable/man/other-formats/#Compiling-using-Tectonic) looks like an easy answer. But I hit the next roadblock:

```julia
[ Info: LaTeXWriter: using tectonic to compile tex.
┌ Error: LaTeXWriter: failed to compile tex with tectonic. Logs and partial output can be found in /var/folders/t2/6mc816z13z561xv9r6rdw84c0000gn/T/jl_m4bFT4.

```

Digging in that logs file reveals that I didn’t have DejaVu Sans and DejaVu Mono installed. Ah, yes, that’s on the documentation, too… ok, downloaded from [https://dejavu-fonts.github.io](https://dejavu-fonts.github.io)…

But then I hit the problem that I don’t have the pygmentize/minted package installed. And now I’m stuck: ~~How do I install a package from CTAN with tectonic\_jll?~~

In the logs I got:

```julia
! Package minted Error: You must have `pygmentize' installed to use this packag
e.

```

---

<div class="post-metadata">

**Author:** ![Perrin\_Meyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/perrin_meyer/32/15686_2.png) [@Perrin\_Meyer](https://discourse.julialang.org/u/Perrin_Meyer)\
**Post date:** [May 19, 2022, 10:15pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/2 "2022-05-19T22:15:47Z")

</div>

LaTex is hard to install from individual packages. I usually just install a big TeXLive install, and through that you can get all the fonts, packages, etc…

[https://www.tug.org/texlive/](https://www.tug.org/texlive/)

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [May 20, 2022, 3:30am UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/3 "2022-05-20T03:30:13Z")

</div>

In case you need inspiration, @odow did this for (the fairly complex) documentation in JuMP:  
[https://github.com/jump-dev/JuMP.jl/pull/2760/files](https://github.com/jump-dev/JuMP.jl/pull/2760/files)

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [May 20, 2022, 5:59am UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/4 "2022-05-20T05:59:12Z")

</div>

On CI, as in the JuMP example, using the Docker platform (`format = Documenter.LaTeX(platform = "docker"`) is the easiest option, as that pulls a Docker image that has all the necessary dependencies. You can also use it locally if you have Docker installed.

For the Tectonic issue… I believe it should download the TeX dependencies automatically…? So is it the Python package that is missing? On Linux, that should be available via the package manager (e.g. `apt install python-pygments` or something like that).

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 20, 2022, 1:04pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/5 "2022-05-20T13:04:14Z")

</div>

Oooh, I see, it’s not a TeX package I need, but rather it’s that the TeX package `minted` (which is in that tectonic distribution) needs `pygmentize`, which comes from a Python package. Is it looking for a `pygmentize` executable to be on my PATH?

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 20, 2022, 1:35pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/6 "2022-05-20T13:35:57Z")

</div>

Yep. It’s in the `pygments` package.

I have just learned about tectonic from this thread. Seems great for any situation where you need to TeX something fast or in containers/CI, but the absence of proper package management makes me a bit skeptical if I would replace my TeXLive on my main system with it.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 20, 2022, 1:47pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/7 "2022-05-20T13:47:13Z")

</div>

Hm, ok, I actually do have pigmentize installed… in my Julia-managed conda folder. How do I get tectonic to see this?

```julia
$ PATH="~/.julia/conda/3/bin:$PATH" julia --project -q
shell> pygmentize --help
Usage: /Users/mbauman/.julia/conda/3/bin/pygmentize [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]
          [-O <options>] [-P <option=value>] [-s] [-v] [-x] [-o <outfile>] [<infile>]

# ...

julia> include("docs/make.jl")
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: LaTeXWriter: creating the LaTeX file.
[ Info: LaTeXWriter: using tectonic to compile tex.
┌ Error: LaTeXWriter: failed to compile tex with tectonic. Logs and partial output can be found in /var/folders/t2/6mc816z13z561xv9r6rdw84c0000gn/T/jl_vsMvVD.
│ exception =
│ failed process: Process(#=...=#) [1]
│
└ @ Documenter.Writers.LaTeXWriter ~/.julia/packages/Documenter/tBpqI/src/Writers/LaTeXWriter.jl:200
ERROR: LoadError: Compiling the .tex file failed. See logs for more information.

```

And the logs show the same:

```julia
! Package minted Error: You must have `pygmentize' installed to use this packag
e.

See the minted package documentation for explanation.

```

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 20, 2022, 2:14pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/8 "2022-05-20T14:14:26Z")

</div>

Huh. Worked for me out of the box with `pygments` installed via `conda` on Windows with  
`format = Documenter.LaTeX(platform="tectonic", tectonic=tectonic())`

Does the `tectonic` command have the `conda/bin` path in its environment?

```julia
using tectonic_jll

tectonic()

```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 20, 2022, 2:38pm UTC](https://discourse.julialang.org/t/convincing-documenter-to-create-a-pdf-output/81337/9 "2022-05-20T14:38:04Z")

</div>

Yep:

```julia
$ PATH="~/.julia/conda/3/bin:$PATH" julia --project -q
julia> using tectonic_jll

julia> tectonic().env[1]
"PATH=/Users/mbauman/.julia/artifacts/3bb83a2812f716f0d1610026d1e470dbf92a952e/bin:/Users/mbauman/.julia/artifacts/2cb0d96a63120d1a0868c905452895a59add9a0d/bin:/Users/mbauman/.julia/artifacts/177d0c3c85c9de270494ca5bb483d7a6d15b3ee8/bin:/Users/mbauman/.julia/artifacts/fce62671858920d3556be53bfdb2604f9dd979c6/bin:/Users/mbauman/.julia/artifacts/9dc7efd1fa13f0fae6d824676bd2f8beabc4c99e/bin:~/.julia/conda/3/bin:/Users/mbauman/bin:/Users/mbauman/.dotfiles/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"

```

Maybe it doesn’t like tildes in the PATH? AHA! Yep:

```julia
$ PATH="/Users/mbauman/.julia/conda/3/bin:$PATH" julia --project -q
julia> include("docs/make.jl")
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: LaTeXWriter: creating the LaTeX file.
[ Info: LaTeXWriter: using tectonic to compile tex.

julia>

```

Success! Thanks everyone!
