Hugo
Getting started
Hugo
In a Hugo site, LA TEX lives in a shortcode. Copy two files from integrations/hugo/layouts/ into your site – the shortcode latex.html and the partial reflowtex-viewer.html – and include the partial once, before </body>. Then run prebuild.py before every hugo build: it compiles the blocks, embeds the schema and provisions the fonts. This site is built that way.
{{< latex >}}
\[ e^{i\pi} + 1 = 0 \]
{{< /latex >}}
{{< latex file="01-inline-math.tex" />}} <!-- a shared .tex file -->
Shortcode options
preamble="name" use latex-preambles/name.tex; editing it recompiles the blocks that use it.
show-source="true" print the block’s LA TEX under it, as on the pages of this documentation.
color-map="name" recolour the block per theme with latex-color-maps/name.json; params.latexColorMap in the site’s configuration sets a default for every block.
width, align, and the Knuth–Plass knobs passed to the viewer; see integrations/hugo/README.md.
A block that refers to its own labels is compiled twice, so \ref and \eqref resolve; a label on another page resolves through the link map prebuild.py writes.