Wiki source code of LaTeX
Last modified by Vincent Massol on 2026/08/30 19:44
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
2.1 | 1 | The [[LaTeX Syntax 1.0>>doc:extensions:Extension.LaTeX.Syntax 1\.0.WebHome]] renderer produces its LaTeX through a system of templates, and every one of those templates can be overridden. Changing what an export looks like is therefore a matter of supplying your own template, not of patching the renderer. |
| 2 | |||
| 3 | You rarely drive the renderer yourself: it runs behind the [[LaTeX Exporter>>doc:documentation.extensions.user.latex.export-page.WebHome]], and what you customize is what comes out of it. | ||
| 4 | |||
| 5 | {{plantuml}} | ||
| 6 | @startuml | ||
| 7 | !theme bluegray | ||
| 8 | skinparam componentStyle rectangle | ||
| 9 | |||
| 10 | component "**Wiki page**" as PAGE | ||
| 11 | component "**XDOM**\none Block per piece of content" as XDOM | ||
| 12 | component "**Templates**\none Velocity template per Block\n//a template of yours wins over the default one//\n//and extension points add to the ones you keep//" as TPL | ||
| 13 | component "**LaTeX**" as TEX | ||
| 14 | |||
| 15 | PAGE --> XDOM : parsed | ||
| 16 | XDOM --> TPL : one lookup per Block | ||
| 17 | TPL --> TEX : rendered | ||
| 18 | @enduml | ||
| 19 | {{/plantuml}} | ||
| 20 | |||
| 21 | == The Template System == | ||
| 22 | |||
| 23 | [[Template Mechanism>>doc:documentation.extensions.dev.latex.template-mechanism.WebHome]] explains how a Block becomes LaTeX: which template is looked up for it, in what order, and how a Block can ask for one by name. [[Template Script Bindings>>doc:documentation.extensions.dev.latex.template-bindings.WebHome]] is the reference for what a template can call once it runs. | ||
| 24 | |||
| 25 | [[Override a Template>>doc:documentation.extensions.dev.latex.override-template.WebHome]] is the procedure, in a form that survives an upgrade of the extension. Three worked examples sit below it: [[Customize the Preamble>>doc:documentation.extensions.dev.latex.override-template.customize-preamble.WebHome]], [[Render Table Cells in Italic>>doc:documentation.extensions.dev.latex.override-template.italic-table-cells.WebHome]] and [[Wrap Long Table Cells>>doc:documentation.extensions.dev.latex.override-template.wrap-table-cells.WebHome]]. | ||
| 26 | |||
| 27 | [[Add Support for a Macro>>doc:documentation.extensions.dev.latex.macro-templates.WebHome]] gives a macro a LaTeX form of its own. | ||
| 28 | |||
| 29 | == Extending Without Owning a Template == | ||
| 30 | |||
| 31 | [[Extension Points>>doc:documentation.extensions.dev.latex.extension-points.WebHome]] lists the UI extension points the templates expose. They let an extension add to the generated document, a ##\usepackage## line for instance, without taking over the template it adds to. | ||
| 32 | |||
| 33 | [[Export Part of a Page>>doc:documentation.extensions.dev.latex.conditional-export.WebHome]] goes the other way: keeping a piece of a page out of the export, decided in the page itself. | ||
| 34 | |||
| 35 | == The Export Package == | ||
| 36 | |||
| 37 | An export produces more than one rendered page. [[Export Package>>doc:documentation.extensions.dev.latex.export-package.WebHome]] describes what the output filter assembles and how its pieces relate. [[Customize the Index Template>>doc:documentation.extensions.dev.latex.export-package.index-template.WebHome]] changes the ##index.tex## that ties them together, and [[Output Filter Parameters>>doc:documentation.extensions.dev.latex.export-package.filter-parameters.WebHome]] is what you need to drive the filter from code rather than from the export form. | ||
| 38 | |||
| 39 | == Calling the Renderer Directly == | ||
| 40 | |||
![]() |
5.1 | 41 | [[Renderer API>>doc:documentation.extensions.dev.latex.rendering-api.WebHome]] is the exception: rendering an XDOM as LaTeX yourself, from Java or from Velocity, as a whole document or as a fragment of one. |
