Wiki source code of Convert a LaTeX Package to PDF

Last modified by Vincent Massol on 2026/08/30 19:36

Show last authors
1 The **LaTeX** format of the [[export menu>>doc:documentation.extensions.user.latex.export-page.WebHome]] gives you a ZIP of LaTeX sources, not a finished document. Compile it into a PDF yourself when your wiki offers no **PDF (LaTeX)** entry because it has no [[PDF conversion>>doc:documentation.extensions.admin.latex.pdf-conversion.WebHome]] set up, or when you want to edit the sources before compiling them.
2
3 The commands below run ##pdflatex## inside a Docker container, so the only thing you have to install is Docker itself.
4
5 1. Unzip the package and put yourself at its root. Download the helper script of the [[blang/latex~-docker project>>https://github.com/blang/latex-docker]] next to ##index.tex##, and make it executable.(((
6 {{code language="bash"}}
7 wget https://raw.githubusercontent.com/blang/latex-docker/master/latexdockercmd.sh
8 chmod +x latexdockercmd.sh
9 {{/code}}
10 )))
11 1. Compile ##index.tex## by running the helper **twice**. A single run leaves the table of contents empty, [[for the reason the wiki's own PDF conversion also compiles twice>>doc:documentation.extensions.admin.latex.pdf-conversion.WebHome]].(((
12 {{code language="bash"}}
13 ./latexdockercmd.sh pdflatex -shell-escape index.tex
14 ./latexdockercmd.sh pdflatex -shell-escape index.tex
15 {{/code}}
16
17 {{image reference="generated-pdf-contents.png" size="large" alt="The table of contents of the generated PDF, filled in by the second pdflatex run"/}}
18 )))
19 1. Open ##index.pdf##, next to ##index.tex## at the root of the package. It holds the exported pages typeset, with their images and the table of contents in front of them.(((
20 {{image reference="generated-pdf-page.png" size="large" alt="A page of the generated index.pdf, showing an exported wiki page typeset by pdflatex"/}}
21 )))

Get Connected