Export Package

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

Explanation

Exporting to LaTeX produces a zip, and that zip is a small LaTeX project rather than one long file. For each page it exports, the output filter builds the page's XDOM, hands it to the LaTeX renderer, and writes the result as a file of its own; it then adds an index.tex that ties those files together. Everything a compiler needs is inside the zip, so the package builds anywhere a LaTeX distribution is installed. That filter can also be driven from code, with parameters of its own.

What the Package Holds

EntryWhat it is
index.texThe document to compile. It carries the preamble, whatever the export options asked for around the content, and one \include per page file.
pages/One LaTeX file per exported page.
files/attachments/Every attachment and image the exported pages reference, copied out of the wiki.
files/downloaded/Images the pages display from an external address, fetched while the export runs.

The last entry appears only when a page shows an image that lives outside the wiki. An image is always downloaded into the package, because a compiler cannot go and get it later; an ordinary link is left pointing where it pointed.

Every Page File Is a Document of Its Own

A file under pages/ is not a fragment. It has its own \documentclass, its own preamble and its own \begin{document}, exactly as if that single page had been exported alone. That is why index.tex loads the standalone package before including them: standalone keeps the body of an included document and drops its preamble.

Two things follow. Any page file compiles on its own, which is the quickest way to see what one page produced. And everything the export options wrap around the content, from the cover page to the table of contents and the lists of figures and tables, is written into index.tex alone, so compiling the package means compiling that file.

Why the Paths Look Like That

The names inside the package are not the wiki's names. Each part of a path is cleaned first: spaces go, the characters LaTeX reads as markup go with them, and anything non-ASCII is percent-encoded before the percent signs are removed in turn. What is left is a path that can sit inside \include{} or \includegraphics{} without being taken for markup.

That cleaning is lossy, so two different names can collapse onto the same one. The hash of the original name, inserted before the extension, is what keeps them apart, which is how an attachment named späce percent%dot.some.png arrives as spC3A4cepercentdot.some-1407747243.png.

Every reference in the package is relative to the package root. A compiler run from anywhere else will not find the page files or the images.

What Does Not Travel

Links out of a page are rewritten, not resolved into the package. A link to another wiki page becomes an absolute address of that wiki, rendered as an \href, and it stays one even when the page it points at is in the same package; the package holds no cross-references between its own pages. A link a page makes to itself keeps its label and loses its link altogether.

FAQ

Can one package hold several pages?

The export action exports a single page, so a package produced from the wiki holds one file under pages/. The filter itself accumulates the pages it is handed and index.tex lists every one of them, but driving it with more than one document does not work today: the zip that comes out holds only the last document's files.

Where does index.tex come from?

From the Index template, which the filter renders after the last page file is written. Customize the Index Template replaces it.

More

To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.

Related

Get Connected