Guide

Templates, packages
and your own macros

For authors who know LaTeX: what the templates already load, where your own packages and macros go, and what the Print View needs from them.

How a texlode document is built

texlode typesets with LuaLaTeX from TeX Live 2025. The Book, Monograph and Proceedings templates use the KOMA-Script class scrbook. A document has this chain:

  • main.tex loads the class and inputs structure/preamble.tex.
  • The preamble inputs the template’s package files (lib/*.tex) and its style files (style/*.tex).
  • Last, it inputs structure/custom-preamble.tex if that file exists. This is your file. The template never ships it, so template updates leave it alone.

texlode runs a fixed TeX Live 2025 installation. You cannot install packages yourself yet. If you need one that is missing, ask us through Help → Chat Support.

What the Book template loads, and why

  • fontspec and unicode-math handle OpenType fonts and Unicode input; realscripts gives true superscripts, and amsmath the usual math environments.
  • scrlayer-scrpage sets running heads and page numbers. widows-and-orphans and needspace keep lines together, multicol sets columns, and microtype refines spacing in the print PDF (not in e-books).
  • Tables use array, booktabs, tabularx and multirow; lists use enumitem.
  • Figures and boxes use graphicx, wrapfig, adjustbox, tikz, tcolorbox and wallpaper.
  • babel and csquotes set hyphenation and quotation marks for the document language.
  • biblatex with biber builds the bibliography, imakeidx the index; hyperref, nameref, xurl, footnotehyper and endnotes handle links, references and notes.
  • fvextra sets code blocks; xcolor, ulem, pifont, etoolbox and xstring are helpers the style files use.

The default fonts are Crimson Pro for text, Source Sans as the sans-serif font, Source Code Pro for code and XITS Math for formulas. Change them under Settings → Fonts.... The Monograph and Proceedings templates load nearly the same set.

Adding a package or macro

Open Settings → LaTeX Preamble.... The text field edits structure/custom-preamble.tex, which loads after the template’s own preamble. Click Save and restart typesetting. The engine restarts for the whole document, which interrupts the print view for a moment.

\usepackage{siunitx}
\newcommand{\vect}[1]{\mathbf{#1}}

texlode checks what you save:

  • A line that is not allowed (see below) blocks the save: “Preamble not saved: the security scan blocked 1 line(s)”, with the reason for each line.
  • A package that fights the template saves with a warning, for example “the template owns page layout, headings and spacing. Use Page Setup and Typography instead.”
  • If the new preamble stops LuaLaTeX from starting, texlode puts the previous version back and shows the TeX error.

Some inserts add their package for you. When you insert a layout element that needs tcolorbox, wrapfig, multicol, lettrine or epigraph and the document does not load it, texlode adds it to your preamble.

What the Print View needs from your code

Commands the preamble refuses

texlode runs on shared servers, so the preamble may not run Lua or touch files. It refuses:

  • Lua: \directlua, \latelua, \luaexec.
  • File access: \openin, \openout, \read, \write, \immediate, and \input of a path with .. or outside the document.
  • Code that changes how TeX reads input: \catcode, \csname, \scantokens, and expl3 syntax (\ExplSyntaxOn).
  • Output primitives: \special, \shipout, \output.

Ordinary definitions are fine in the preamble: \newcommand, \renewcommand, \def, \newenvironment, and \makeatletter for patching an internal macro. Chapter text is stricter: \def, \makeatletter and \usepackage are refused there, so keep definitions in the preamble.

Shell escape is off for every typesetting run. Packages that call external programs, such as minted with Pygments, cannot do so.

Only TeX Live packages

A \usepackage must name a package installed in texlode’s TeX Live. Any other name is refused as “not a TeX Live package”, and texlode does not accept uploaded .sty or .cls files. Copy the definitions you need from such a file into the preamble instead.

Fonts and encoding under LuaLaTeX

Your source is UTF-8 and fonts come from fontspec. Leave out inputenc and fontenc; the preamble editor warns that the template already loads them. pdfLaTeX font packages such as times, mathptmx, newtxtext or libertine are reported as “superseded by the template’s unicode-math / biblatex / fontspec stack”. Choose the font under Settings → Fonts... instead. The same warning covers natbib and cite, which conflict with biblatex.

Layout belongs to the template

geometry, fancyhdr, titlesec, setspace, tocloft and similar packages redo what the template already controls. Set trim size and margins under Settings → Page Setup..., and headings and spacing under Settings → Typography... or in the Inspector. For running heads, use the KOMA-Script commands in the example below.

Commands the Print View does not know

The Print View typesets each paragraph with a known set of commands. A command outside that set appears in red strikethrough in the Text Editor, and the Print View leaves it out together with its arguments. Commands inside math are always passed to LaTeX.

Your own macros from the custom preamble join the known set when their definition uses only commands the Print View knows. A macro built on TeX programming stays unknown to the Print View. The same holds for environments: \newenvironment, \NewDocumentEnvironment and \newtheorem (also ntheorem's \newshadedtheorem and \newframedtheorem) render in the Print View, while environments created by package commands (\newtcolorbox, \lstnewenvironment) show their content as plain text.

Build PDF uses the Print View pages, so it has the same gaps. The LaTeX PDF tab of the Publish dialog typesets your source with LuaLaTeX itself and includes them.

If main.tex itself has preamble lines the Print View cannot load, the Checks list them under Lines of main.tex the Print View does not load. The lines stay in the file and apply to the full typesetting run.

Bibliography with biblatex

The templates load biblatex with biber as the backend:

\usepackage[style=\citestyle,doi=true,url=false,eprint=false]{biblatex}
\addbibresource{bibliography.bib}

Your references live in bibliography.bib in the document’s root folder, next to main.tex. To change the citation style, select the bibliography page and open the Inspector. Citation Style offers the styles that come with biblatex: authoryear, authoryear-comp, numeric, numeric-comp, alphabetic, authortitle and verbose. Per-Chapter Bibliography prints a bibliography after each chapter.

Do not load biblatex a second time with your own options. Set further options in the preamble instead:

\ExecuteBibliographyOptions{maxcitenames=2, giveninits=true}

Worked examples

Headers and footers

The template sets running heads with scrlayer-scrpage: the chapter title in the outer header and the page number in the outer footer. To center both and set them in small italics, add this to the preamble:

\ohead*{}
\chead*{\headmark}
\ofoot*{}
\cfoot*{\pagemark}
\setkomafont{pageheadfoot}{\normalfont\small\itshape}

A theorem-like environment

\newtheorem numbers and formats the environment in the Print View as in the PDF:

\newtheorem{example}{Example}[chapter]

In the text, write \begin{example} ... \end{example}.

An extra float type

KOMA-Script’s \DeclareNewTOC defines a float with its own counter, caption name and list:

\DeclareNewTOC[type=infobox, types=infoboxes, float, name=Box, listname={List of Boxes}]{lob}

Use it like a figure: \begin{infobox} ... \caption{...} \end{infobox}, and print the list with \listofinfoboxes. The environment comes from a package command, so the Print View does not place it as a float; the full typesetting run does.

Code listings

For code, use the Verbatim environment of fancyvrb and fvextra, which the template loads with line breaking turned on, so long lines wrap at the margin. A minted block works too. The print view and Build PDF colour it by its language; the full typesetting run sets it as a plain verbatim block, because shell escape is off (see Where texlode differs from LaTeX).

\begin{Verbatim}
for chapter in book:
    print(chapter.title)
\end{Verbatim}

To use lstlisting, add \usepackage{listings} to the preamble.

Linguistic glosses

The gloss packages gb4e, expex and linguex are not installed, so texlode cannot typeset interlinear glosses yet. For phonetic symbols, tipa is available. If you need gloss support, tell us through Chat Support.

Related guides