texish

Command Reference

Every command, grouped by topic. Those marked (format) require \use{document} (or the named package); the rest are engine primitives available in any document. The engine variables they read are in…

Every command, grouped by topic. Those marked (format) require \use{document} (or the named package); the rest are engine primitives available in any document. The engine variables they read are in Parameters and Variables, and the \picture drawing commands are in the Drawing Reference.

Document structure (format)

CommandEffect
\title{…} \author{…} \date{…}set the title-block fields
\maketitletypeset the centered title block
\begin{abstract}…\end{abstract}a centered, indented summary
\section{…} \subsection{…} \subsubsection{…}auto-numbered headings (each has a starred, unnumbered form)
\paragraph{…} \subparagraph{…}bold run-in headings below the numbered levels
\appendixletter the top level from here on — A, B, … (in book, the chapters)
\begin{itemize} \begin{enumerate} \itembulleted and numbered lists
\begin{description} \item[Term]terms with hanging definitions
\begin{quote} \begin{quotation}indented quotation blocks
\footnote{…}a numbered footnote
\marginpar{…}a note in the margin beside the line, taking no room in the text
\figure[htb]{…} \table[htb]{…} \caption{…}floats with numbered captions

List labels change with depth and each is a macro of its own, so redefining one changes that level throughout: \labelenumi\labelenumiv are 1., (a), i., A., and \labelitemi\labelitemiv are , , , ·. Each enumerate level counts on its own counter (enumienumiv), so a nested list never disturbs the one around it. \marginparwidth, \marginparsep and \marginparstyle are the margin note’s measure, gap and setting; a two-sided document puts its notes in the outer margin.

Citations, bibliography and index (format)

Both resolve across passes, like every other cross-reference: an index or a citation of something the pass has not reached yet appears once the document has been set through.

CommandEffect
\begin{thebibliography}…\end{thebibliography}a numbered reference list, under \bibname
\bibitem{key}open one entry, numbered, and label it under key
\cite{key} \cite{key other}print the entry numbers in one bracketed group — [1], [1, 2]
\index{term}mark this point as a place term is discussed; draws nothing
\printindexset the collected terms alphabetically, each with its pages
\indexlist{list}{format}low-level: replay a named list gathered by title — one call per distinct term, sorted, with its pages deduplicated and joined — as format{level}{number}{title}{pages}
\marginalnote rise:… {offset}{width}{…}low-level: the box \marginpar is built on, placed at offset from the left edge of the text block

In book the reference list and the index open as chapters rather than sections, and \bibname is “Bibliography” rather than “References”.

Cross-references and contents (format)

The document is typeset twice over a shared label table, so forward references resolve.

CommandEffect
\label{name}bind a name to the current section/figure number, kind, title and page
\ref{name}print that number (?? until resolved)
\pageref{name}print the page the label landed on
\eqref{name}print the number in parentheses, as for an equation
\autoref{name}print the number with its kind in front (e.g. Section 3, Figure 1)
\nameref{name}print the title of the labelled section or caption
\tableofcontents \contentsa contents list built from the section headings
\listoffigures \listoftableslists of captioned figures / tables (\listoffigs \listoftabs add the heading)
\addcontentsline{list}{level}{number}{title} \tocentry{level}{number}{title}low-level: file an entry into a named list (toc/lof/lot) — sectioning and \caption call these
\contentslist{list}{format}low-level: replay any named list through a format macro called as format{level}{number}{title}{page} — the general form of \tableofcontents, for keeping several independent contents lists (e.g. one per language)

Text and markup

CommandEffect
\italic{…} \bold{…} \slanted{…} \smallcaps{…}italic, bold, slanted, small caps
\serif{…} \sans{…} \mono{…}roman / sans-serif / typewriter member of the family
\textsub{…} \textsup{…}text subscript / superscript
\color[alpha]{name} \textcolor[alpha]{name}{…}pen colour (CSS name, #RRGGBB, #RRGGBBAA, or transparent; optional [alpha] 0–1)
\pagecolor[alpha]{name}colour painted across the whole page under all content (translucent or transparent for overlays); set in the preamble
\thecolor \thepagecolorthe pen and the page colour in force, as a #RRGGBB string (#RRGGBBAA when translucent) — read them where you draw, so a figure can follow the document’s scheme rather than name a colour of its own
\href{url}{text} \url{url}clickable links (real PDF annotations)
\TeX \LaTeX \TeXishthe logos (\use{document})
\dropcap[lines][gap]{X}{rest}drop cap spanning lines lines (default 2), sized by measurement; rest continues the word through the redefinable \dropcaptext (small caps by default) (\use{document})
…’’ `` -- --- ... ~quotes, dashes, ellipsis, tie
\$ \& \# \% \{ \} \\ \~literal special characters ($ & # % { } \ ~)

Fonts and font shape

\bold/\italic/\smallcaps/\slanted wrap an argument; the declarations switch the font for the rest of the enclosing group (so an environment can set its whole body in one shape) and revert at the closing brace or \end. Family roles select the roman/sans/typewriter member of the current super-family, keeping weight and slope.

Small caps come from a real cut when the family has one (Latin Modern, Alegreya SC); otherwise, if the current face carries the OpenType smcp feature (EB Garamond and most modern text romans), \smallcaps/\scshape synthesise true small capitals from that feature rather than falling back to ordinary lowercase.

\mono/\ttfamily and \sans/\sffamily fall back to a document-level typewriter or sans family when the current family has no such member (Garamond, Cinzel, Amiri …), so an inline \mono never fails. \ttdefault{name}/\sfdefault{name} name those fallback families (Latin Modern by default); the target may be a super-family with a typewriter/sans member or a standalone family whose plain cut is the typewriter (\ttdefault{jetbrains}).

CommandEffect
\font{face}{size}{style}select typeface, size and style together
\fontsize{size}change only the size, keeping the typeface and shape
\fontscale{factor}{style}re-select the current typeface at the current size × factor
\typeface{name}select a typeface by name
\loadfont{name}{path}register a font file from disk under a typeface name
\bold{…} \italic{…} \slanted{…} \smallcaps{…}shape-wrapping commands
\serif{…} \sans{…} \mono{…}roman / sans / typewriter member of the super-family
\itshape \slshape \bfseries \scshapedeclare italic / slanted / bold / small-caps for the group
\upshape \mdseries \normalfontclear the shape axis / clear bold / return to the plain face
\rmfamily \sffamily \ttfamilydeclare roman / sans / typewriter for the group
\ttdefault{name} \sfdefault{name}name the fallback typewriter / sans family for \mono / \sans
\accent{mark}{char}combine an accent mark with a base character

Bundled text faces

Four faces are core — compiled into the artifact, so they are there whatever a host has installed:

  • \font lmroman — Latin Modern, the default body face, with its sans and typewriter roles and its small-caps and slanted cuts.
  • \font lmmath — Latin Modern Math, the default math font.
  • \font newcm — New Computer Modern, also the glyph-fallback face (see below).
  • \font jetbrains — JetBrains Mono, the face \code sets a listing in, in regular and bold.

Every other bundled face is catalogue: it comes from a font tree on disk, and a host asks for the set with loadBundledCatalogue() (the command-line tool does this for you). Among the Latin text faces there:

  • \font cinzel — an all-capitals inscriptional titling serif in the Trajan tradition, for titles and chapter openings, in six weights (regular, medium, semibold, bold, extrabold, black).
  • \font ebgaramond — a Garamond revival for running text, with italic, the medium/semibold/ extrabold weights and their italics, a real bold, and true small caps through the smcp feature.
  • \font alegreya, \font gentium, \font gentiumbook, \font noto, \font pt, and the rest of JetBrains Mono’s weight range.
  • \font chess — Noto Sans Symbols 2, named for what the chess package stamps its pieces from. No text face covers the Miscellaneous Symbols chess block (U+2654–265F).

Naming a catalogue face on an installation that has no font tree is an error that says so, naming the file it went looking for. Any face texish does not bundle is brought in with \loadfont{name}{path}.

Glyph fallback (Cyrillic, Greek)

A codepoint the current face has no glyph for is set from New Computer Modern (\font newcm) rather than drawn as a missing-glyph box, so Cyrillic and Greek work in ordinary text with no setupПривет, αβγ — and, because New Computer Modern is Computer Modern, the substituted glyphs sit invisibly beside Latin Modern.

The substitution matches the weight and slope of the text around it: Cyrillic inside a \bold{…} heading is set from the fallback’s bold cut, so the weight does not break mid-phrase. The family role is the one thing not carried over — the fallback stands in for a face’s coverage, not its family, so Cyrillic inside \mono is set in the fallback’s roman rather than sent to the typewriter family, which is no likelier to have the glyph.

Chinese, Japanese and Korean

Chinese and Japanese text has no spaces between characters, so the line breaker inserts its own break opportunities between adjacent characters and applies kinsoku — a closing mark never starts a line and an opening mark never ends one — then justifies the line by stretching the inter-character space. This happens automatically for any run of Chinese or Japanese text; the line breaker is otherwise unchanged.

Noto Serif CJK is bundled with a face for each region, since Han (kanji/hanja) has region-specific glyph forms and Korean adds the Hangul syllables the Chinese faces do not carry:

  • \font cjksc — Simplified Chinese (also the default noto-adjacent face for Han)
  • \font cjktc — Traditional Chinese
  • \font cjkjp (alias \font japanese) — Japanese, with the Japanese kanji forms and the kana
  • \font cjkkr (alias \font korean) — Korean Hangul (and Hanja)

Each has a regular and a bold cut (\font cjkjp 12 bold). Korean breaks differently: it is written with interword spaces, so its lines break at those spaces the way Latin does, rather than between syllables. A break inside a Korean word is offered only as a last resort, at a heavy penalty, so a run with no space in it still wraps instead of overflowing. Any other CJK font can be brought in with \loadfont{name}{path}.

Devanagari (Hindi)

Devanagari text is shaped a syllable at a time: consonants fuse into conjuncts and half-forms, the short-i sign and a word-initial reph are reordered, a nukta composes with its consonant, and the vowel signs are positioned by the font — all automatically from text typed in Unicode order. Noto Serif Devanagari is bundled: \font devanagari 12 regular (or the alias \font hindi), with a bold cut (\font devanagari 12 bold). See Devanagari (Hindi) for the full treatment.

Bengali–Assamese

Bengali text is shaped a syllable at a time: consonants fuse into conjuncts, the pre-base i/e/ai signs are reordered, the two-part o and au signs are split into a front and a trailing part, a word-initial reph and a post-base ya-phalaa are formed, a nukta composes with its consonant, and the vowel signs are positioned by the font — all automatically from text typed in Unicode order. Noto Serif Bengali is bundled: \font bengali 12 regular (or the alias \font assamese), with a bold cut (\font bengali 12 bold). See Bengali–Assamese for the full treatment.

Gujarati

Gujarati is Devanagari’s closest relative here, written without the shirorekha, and is shaped the same way: consonants fuse into conjuncts and half-forms, the pre-base i sign is reordered ahead of its syllable, and a syllable-initial ra with a virama rises as a reph above the base — closing the cluster after any post-base vowel sign, as Devanagari’s does rather than as Bengali’s does. Every vowel sign is a single codepoint, so nothing is split. All of it happens automatically from text typed in Unicode order. Noto Serif Gujarati is bundled: \font gujarati 12 regular, with a bold cut (\font gujarati 12 bold). See Gujarati for the full treatment.

Gurmukhi (Punjabi)

Gurmukhi text is shaped a syllable at a time: a consonant joined by the virama takes a subjoined pairin form beneath the base, the pre-base sihari (i-sign) is reordered, and the addak, the nasal tippi and bindi, and the vowel signs are positioned by the font — all automatically from text typed in Unicode order. Unlike Devanagari and Bengali, Gurmukhi has no reph. Noto Serif Gurmukhi is bundled: \font gurmukhi 12 regular (or the alias \font punjabi), with a bold cut (\font gurmukhi 12 bold). See Gurmukhi (Punjabi) for the full treatment.

Kannada

Kannada builds downward like Telugu: a consonant joined by the virama is drawn as the ottakshara beneath the base, so the base of a conjunct is its first consonant rather than its last, and a consonant and its vowel sign commonly fuse into a single drawn glyph. A vowel sign belongs to the base and is moved back across the subscripts to reach it. Where it differs from Telugu is that it forms a reph — a syllable-opening ra is lifted out as the arkavattu and set after the syllable, taking its own room on the line rather than floating above it as Devanagari’s does — and that five of its vowel signs are written as combinations of others, one of them nesting two deep ( is plus a length mark, and is an e sign plus a uu sign). All of it happens automatically from text typed in Unicode order. Noto Serif Kannada is bundled: \font kannada 12 regular, with a bold cut (\font kannada 12 bold). See Kannada for the full treatment.

Telugu

Telugu builds downward: a consonant joined by the virama is drawn as a subscript beneath the base, so the base of a conjunct is its first consonant rather than its last, and a consonant and its vowel sign commonly fuse into a single drawn glyph. A vowel sign belongs to the base, so it is moved back across the subscripts to reach it — ప్రేమ joins its vowel to the pa, not to the subjoined ra. The ai sign is split into the two parts the font draws, and a word-initial ra with a virama forms no reph. All of it happens automatically from text typed in Unicode order. Noto Serif Telugu is bundled: \font telugu 12 regular, with a bold cut (\font telugu 12 bold). See Telugu for the full treatment.

Tamil

Tamil keeps its virama on the page as the pulli, a dot above the consonant it silences, rather than folding that consonant into a half-form or subjoining it beneath the base. A silenced consonant is therefore a letter in its own right, and a pre-base vowel sign moves before the consonant it belongs to rather than to the front of the syllable: க்கே sets ka, pulli, the ee sign, ka. The two-part o, oo and au signs are split into the parts the font draws, the u signs fuse with their consonant, the short-i and long-i signs take width-matched forms, and the two surviving conjuncts (க்ஷ and ஸ்ரீ) are drawn as single ligatures — a pre-base sign does reach the front of those, since the ligature has swallowed the pulli. A word-initial ra with a virama forms no reph. All of it happens automatically from text typed in Unicode order. Noto Serif Tamil is bundled: \font tamil 12 regular, with a bold cut (\font tamil 12 bold). See Tamil for the full treatment.

Ethiopic (Amharic, Tigrinya, Ge’ez)

Ethiopic needs no shaping: it is a syllabary, so the vowel is written into the letterform rather than hung on it as a sign, and one codepoint is one glyph. Nothing reorders, nothing joins, there is no bidirectional work — the text takes the plain path through the engine and breaks at its spaces like a roman paragraph. Noto Serif Ethiopic is bundled: \font ethiopic 12 regular (or the aliases \font amharic and \font tigrinya), with a bold cut (\font ethiopic 12 bold). It covers the Ethiopic block along with the Supplement and both Extended blocks. Ethiopic’s own punctuation ( ) and numerals (፩ ፪ ፫) are typed literally. See Ethiopic for the full treatment.

Thai

Thai is written without spaces between words and uses them to separate phrases instead, so a run of it would reach the line breaker as one box and overflow the measure. The breaker offers somewhere to break between orthographic clusters, and never parts a vowel or tone mark from its consonant, nor strands a pre-posed vowel from the consonant that follows it. Charm is bundled: \font thai 12 regular (or \font charm), with a bold cut.

Vowels and tone marks are placed on their consonant by the font’s anchors, so the stacked combinations Thai builds set correctly.

One limitation to know. Thai lines properly break at word boundaries, and finding those needs a dictionary, which texish does not carry — so a cluster break may land inside a word. Because of that it is offered only as a last resort, at a heavy penalty: text with normal phrase spacing breaks at those spaces and never sees one.

Right-to-left scripts

\rtl and \ltr set the paragraph base direction. Faces are bundled for both scripts, each in a regular and a bold cut: \font hebrew (Noto Serif Hebrew) and \font arabic (Noto Naskh Arabic), with the traditional book hands \font amiri (a Naskh alternative to Noto for Arabic) and \font ezra (Ezra SIL, the Biblia Hebraica Stuttgartensia face, with vowel points and cantillation marks) alongside them. Hebrew niqqud, Arabic cursive joining, the lam-alef and Allah ligatures, and Arabic harakat are all applied automatically from the text in logical order — see Right-to-left text for the full treatment.

Text symbols

CommandSymbol
\copyright \textregistered \texttrademark© ® ™
\dag \ddag \S \P† ‡ § ¶
\pounds \textdegree \textbullet£ ° •
\textemdash \textendash— –

Mathematics

CommandEffect
$…$ $$…$$inline and display math
^ _super/subscript
\displaystyle \textstyle \scriptstyle \scriptscriptstyleset the style for the rest of the enclosing sub-formula; {\displaystyle …} enlarges one part of a formula
\frac{a}{b} a \over b a \atop bfractions (\atop stacks with no rule)
\frac rule:<dim> left:<delim> right:<delim> style:<style> {a}{b}a fraction with the bar thickness (0 for none), fences around the stack, and the style all chosen — the general form the others are presets of
\dfrac{a}{b} \tfrac{a}{b}forced display-style / text-style fractions
\binom{n}{k} \dbinom \tbinombinomial coefficients
\sqrt{x} \sqrt[3]{x}roots
\sum \int \prod \limits \nolimitsbig operators (\nolimits forces scripts to the side)
\sin \cos \arcsin \arctan \log \exp \lim \max \det \Prthe standard upright operator names
\operatorname{…}an upright custom operator (like \sin, with operator spacing)
\bmod \pmod{m} \mod{m} \pod{m}modular-arithmetic forms
\implies \impliedby \iffspaced implication arrows
\ldots \cdots \vdots \ddots \dotsellipses (\dots is the low one, as \ldots)
\left( … \right)stretchy delimiters, sized to the formula between them
\fence size:<n> class:<open\|close\|rel\|ord> {(}a delimiter at a size you choose, for a fence that stands on its own; size:0 is the plain glyph and each step climbs the font’s variants (default size:1). The class follows the delimiter unless class: overrides it
\hat \vec \widehataccents
\overbrace{…} \underbrace{…}a horizontal brace spanning the content, above or below it; a script on it rides over the brace (\overbrace{a+b}^{n})
\vcenter{…}set a box centred on the math axis rather than on the baseline
\overset{a}{b} \underset{a}{b} \substack{a \\ b}stack material above / below / in a script pile
\boxed{…}a framed formula
\overline{…} \underline{…}a rule over / under the content (\underline also works in text)
\text{…} \mathcal{…}upright / calligraphic
\mathbf \mathit \mathrm \mathsf \mathtt \mathbb \mathfrakmath alphabets (bold, italic, roman, sans, mono, blackboard, fraktur)
\phantom \hphantom \vphantomreserve a box’s size without drawing it
\smash{…}draw a box but report zero height and depth
\longrightarrow \rightleftharpoonslong / equilibrium arrows
\, \: \; \! \quad \qquadthin / medium / thick / negative-thin / 1em / 2em space
<n>mua math unit, 1/18 em — the unit those spaces are measured in, usable wherever a dimension is (\hskip 3mu, \set g {0mu plus 6mu})
\matrix \pmatrix \bmatrix \vmatrix \Vmatrix \Bmatrix \smallmatrix \casesmatrices
\begin{aligned}…\end{aligned}equations aligned on their & relations (\\ between rows)
\eqno(…) \leqno(…)display equation number, flushed to the right margin / the left

Boxes, spacing, and pages

CommandEffect
\hbox \vbox \vtopexplicit boxes
\mbox{…}an unbreakable horizontal box of its natural width
\makebox[width][l\|c\|r\|s]{…}a box of a set width, content aligned (width = a dimension or a \linewidth factor)
\parbox[t\|c\|b][height][t\|c\|b\|s]{width}{…}set text (one or more paragraphs) in a box of the given width, aligned on the baseline; the optional [height] fixes the box height and [inner-pos] places the content within it (top/centre/bottom/stretch, default = outer pos)
\begin{minipage}[t\|c\|b][height][t\|c\|b\|s]{width}…\end{minipage}the environment form of \parbox, same optional [height]/[inner-pos] (over the \beginminipage/\endminipage primitives)
\wrapbox{side}{width}{…}anchor a box at the left/right margin so following text wraps beside it
\wrapshape{shape}{side}{width}{…}the same, with text following a non-rectangular silhouette
\cutout{width}{height}{side} \cutshape{shape}{width}{height}{side}reserve a rectangular / shaped hole in the running text
\clearwrapdrop past the foot of the current wrap before the next full-width block
\newlength{name} \setlength{name}{d} \addtolength{name}{d}declare / set / adjust a length (a dimension variable, read back as \name)
\centerline \leftline \rightline \centeringalignment
\rlap \llapzero-width overlap boxes
\kern \hskip \vskiprigid / glue spacing
\strutan invisible zero-width box one baselineskip tall, so a line keeps a regular height and depth whatever its glyphs
\smallskip \medskip \bigskipnamed vertical gaps
\parend the current paragraph (the explicit form of a blank line; useful inside a macro)
\indent \noindentforce / suppress the next paragraph’s indent
\leavevmodebegin a paragraph if none is open, keeping the running indent state — for inline content led by a box (e.g. a superscript) that a plain character would otherwise have started
\rtl \ltrset the paragraph base direction right-to-left / left-to-right (see Right-to-left text)
\newpageend the current page and start a new one
\ignorespacesswallow the spaces that follow (at the end of a macro body)
\vfil \vfill \vss \hfil \hfill \hssstretchable fill
\lower \raiseshift a box vertically
\setbox \box \copy \unhbox \unvbox \wd/\ht/\dp \isvoidbox registers, their dimensions, splicing, and the empty test
\vsplit name to:<dim>cut a saved vbox at a page-style breakpoint
\columns {n} {…}set the body as n balanced columns (gap:<dim> before {n} sets the gutter)
\leaders \cleaders \xleadersfill space by tiling a box
\dotfill \hrulefilla dotted / ruled leader (e.g. contents lines)
\discretionary{pre}{post}{no} \softhyphenauthor-controlled break points
\penalty \nobreak \ejectpage-break control (breaks are chosen by cost)
\topinsert \midinsert \botinsertplain-TeX edge floats (the float package builds \figure/\table on these)
\mark{…}drop a mark for running heads (topmark/firstmark/botmark)
\submark{…}the same in a second, independent stream (topsubmark/firstsubmark/botsubmark), so a two-sided head can name a division on one side of an opening and a subdivision on the other

The framing primitives read fboxsep / fboxrule; box and page behaviour is tuned through the parameters (hsize, parindent, baselineskip, tolerance, the page-break penalties, and so on).

Rules, frames, and transforms

CommandEffect
\hrule \vrulea horizontal / vertical rule ([width:…], [height:…], [depth:…] size it)
\fbox{…} \framebox{…}frame the content (padding fboxsep, rule fboxrule, current pen colour)
\colorbox[alpha]{color}{…}fill the content’s background with a colour, no frame (translucent via [alpha] or #RRGGBBAA)
\fcolorbox{frame}{bg}{…}frame in one colour around a body filled with another (either may be #RRGGBBAA)
\rotatebox{deg}{…}rotate the content counter-clockwise about its left baseline
\scalebox{factor}[yfactor]{…}scale the content (one factor scales uniformly)
\reflectbox{…}mirror the content left-to-right
\resizebox{w}{h}{…}scale to a width and height (! for either keeps the aspect ratio)
\raisebox{lift}{…}raise the content, adjusting its reported height and depth

Tables

CommandEffect
\halign{template \cr rows}a column-aligned table; # marks the cell slot in the template, & separates cells, \cr ends a row
\noalign{…}between rows of an \halign, insert material (often an \hrule) outside the column alignment
\omitat the start of a cell, skip its template and set the cell plain
\tabular{cols}{body}the LaTeX form: cols is l/c/r columns and \| rules; the body uses &, \\ and \hline

Verbatim and code

CommandEffect
\verb<delim>…<delim>inline verbatim: the char after \verb delimits, the text is set literally in monospace
\code[language]{…}a code listing in the code face; [language] syntax-highlights it (see the code environment for unbalanced braces)

Both read their text raw from the input, so — like LaTeX’s \verb — they cannot be produced by a macro. \code colours by the theme in codetheme; the code environment takes its language from codelang.

Language

These set the document’s language, which decides both the hyphenation patterns the line breaker uses and the typography the language sets its punctuation by.

CommandEffect
\usehyphenation{tag}load the patterns texish bundles for a language tag (en-us, de-1996, hi, …) and make it the document language
\loadhyphenation{lang}{path}load Liang patterns from a .tex file and make lang the document language
\language{lang}switch to an already-loaded language

texish bundles 78 languages. Five — en-us, es, fr, it, pt — are compiled into the binary and the rest are files in the installation’s hyphenation/ folder; \usehyphenation reaches both alike, so a document names a language without knowing which tier it is in. The full list, and what a pattern file carries besides its patterns, is in the Hyphenation guide.

Declaring French — \usehyphenation{fr}, or any regional tag built on it — also switches on French spacing of high punctuation. French sets a space before the colon, semicolon, exclamation and question marks, and inside its guillemets: a full space before the colon, a narrower one before the rest. That space neither stretches when the line is justified nor offers the line breaker a place to break, so the mark cannot drift from its word or be carried alone to the head of the next line. Type the space or leave it out as you prefer — « Oui ! » and «Oui!» set alike — and the comma and full stop, which French sets tight as English does, are left alone.

Hooks

CommandEffect
\addtohook{name}{code}append an unevaluated code fragment to a named hook
\usehook{name}run every fragment registered on a hook, in order

Page geometry

\geometry sets the page frame the way LaTeX’s geometry package does, but with texish name:value options instead of a key=value list. It resolves the sheet, the text size, and the margins, then sets paperwidth/paperheight, hsize/vsize and hoffset/voffset globally — so a \geometry in the preamble holds for the whole document, and a later call re-frames the pages that follow it (as LaTeX’s \newgeometry does). The far margin is always the remainder, so the frame closes by construction.

OptionEffect
paper:<name>a named sheet: letter, legal, a3, a4, a5, a6
paperwidth:<dim> paperheight:<dim>the sheet size explicitly
landscape:on portrait:onswap the sheet to its wider / taller orientation
margin:<dim>one length for all four margins (hmargin/vmargin for one axis)
left: right: top: bottom:<dim>the four margins individually
textwidth: textheight:<dim> (or width:/height:)the text-block size directly
centering:oncentre the text block (hcentering/vcentering for one axis)
headsep: footskip:<dim>the running-head and running-foot gaps
twoside:onprint both sides: the text block is mirrored on verso (even-folio) pages
inner: outer:<dim>the horizontal margins named by their relation to the binding; either one turns twoside on

Example: \geometry paper:a4 margin:2cm or \geometry left:2in right:1in top:1.5in bottom:1in.

Two-sided, the frame given is the recto, and every verso reflects it about the page’s vertical centre — the recto’s outer margin becomes the verso’s inner one, carrying the running head and foot with the body. So \geometry paper:a5 inner:22mm outer:14mm leaves 22mm against the spine on every page of the book, not on every odd one. The reflection is of the resolved frame, so it holds however the margins were specified, and it follows pageno, the folio a page prints, rather than a count of sheets. The document format’s \ifrecto{…}{…} and \cleardoublepage build on the same parity: the first chooses a branch by side, the second opens the next material on a recto, inserting a blank leaf when it would otherwise fall on a verso.

Page arrangement

\arrange chooses how finished logical pages are placed onto physical sheets — the output routine. The default ships one page per sheet; the booklet arrangements and nup group several. It must appear in the preamble, before any content, because the arrangement fixes the physical sheet size when the output surface is created. Imposition happens in box space, above the rendering backend, so it works on every output target.

FormEffect
\arrange simpleone logical page per sheet (the default)
\arrange two-up-bookletpages two-up in saddle-stitch folding order on a sheet twice as wide, each sheet folded once; the whole book nests as one signature
\arrange four-up-bookletthe two-up layout stacked two folded sheets high, on a sheet twice as tall as well; print, cut in half across the middle, then fold as the two-up booklet
\arrange <booklet> duplexshift:<len>pull the front side <len> left to cancel a printer’s front-to-back registration error (either booklet arrangement)
\arrange two-up-booklet signature:<4k>fold into fixed groups of 4k pages instead of one nested stack (also on four-up-booklet)
\arrange nup rows:<r> cols:<c>tile an r×c grid of pages per sheet, in reading order

The two-up-booklet arrangement sets the logical page with \geometry and lets the arrangement size the sheet: for a pocket A6 booklet folded from A5 paper, \geometry paper:a6 margin:10mm then \arrange two-up-booklet gives A5-landscape sheets carrying two A6 pages each. Print double-sided, fold each sheet once down the middle, nest, and staple, and the pages read in order. A run is padded with blank pages to a whole number of sheets. The name describes the imposition, not the paper, so the same arrangement serves any page size — quarter-letter pages two-up on half-letter sheets, say. Both booklet arrangements take duplexshift:<len> to cancel a duplexer’s front-to-back drift (see below).

The four-up-booklet arrangement prints the same booklet on the next paper size up for cutting: it stacks the two-up layout two folded sheets high, so A6 pages fall four to an A4 sheet. Print double-sided, cut the sheet in half across the middle into two half-height sheets, then fold and nest those exactly as the two-up booklet — no page prints upside-down and nothing is slit. The back is laid out for long-edge duplex; if a fold-test dummy comes out mis-collated, switch the printer to long-edge binding. Padding blanks fall just before the last page, so the front and back covers always land on the outermost sheet. If a duplexer lands the front a millimetre or two off the back, duplexshift:<len> pulls every front side that far left to bring the two into register.

Images and graphics

CommandEffect
\includegraphics[width=,height=,scale=]{path}place a PNG or JPEG
\image{path}place an image at its natural size
\defbitmap{name}{w}{h}{depth}{base64}define an inline bitmap from embedded data (so a package can carry a glyph)
\usebitmap[width:… height:…]{name}place a bitmap defined by \defbitmap
\picture width:… height:… {…}open a vector-graphics drawing

The drawing commands available inside \picture (paths, shapes, strokes, fills, transforms, text, arrows) are listed in the drawing reference.

Two-dimensional barcodes (\use{qrcode}, \use{datamatrix})

CommandEffect
\qrcode[options]{data}encode the data and place the symbol, drawn as one vector rectangle per dark module
\qrmatrix[options]{data}encode without drawing; the rows land in qrmatrixvalue as strings of . and #

The data is read verbatim, so a URL’s // is not a comment and %, ~ and # reach the encoder as themselves. Options ride one optional [key:value …] bracket, and each has a document variable behind it that sets the default for every later call:

OptionVariableEffect
ecc:qqreccerror correction l, m, q or h — default q, and raised automatically to the strongest level the chosen size still holds
cell:3ptqrcellthe side of one module, in any length \calc understands
quiet:4qrquietthe light border, in modules — 4 is the standard’s minimum
dark:qrdarkthe module colour; the pen colour in force by default
light:whiteqrlightthe background; light:none leaves the page showing through

The encoder is written in the document language rather than built into the engine — the mode selection, the Reed-Solomon check codewords and the mask search are all \calc, \for and \put over sequences.

Data Matrix

CommandEffect
\datamatrix[options]{data}encode the data and place an ECC200 symbol
\dmxmatrix[options]{data}encode without drawing; the rows land in dmxmatrixvalue

A Data Matrix packs the same payload into rather less area than a QR code, which is why it is the symbology of shipping labels and of parts marked directly. It has no error-correction setting — ECC200 fixes it by symbol size — and so takes four options rather than five:

OptionVariableEffect
cell:3ptdmcellthe side of one module
quiet:1dmquietthe light border, in modules — 1 is what the standard requires
dark:dmdarkthe module colour; the pen colour in force by default
light:whitedmlightthe background; light:none leaves the page showing through

Square symbols from 10×10 to 48×48, carrying up to 174 codewords — a few hundred characters, or twice that in digits, since a pair of digits costs one codeword. The rectangular symbols and the two largest square ones are not built; a payload too long is reported rather than silently truncated. Text is encoded as UTF-8, so a symbol carrying only ASCII is unambiguous, and no ECI is emitted.

Both packages load barcode, which holds what they share: the payload as bytes, and Reed-Solomon over GF(256). Nothing calls \use{barcode} directly.

Floats and text wrapping (\use{float})

The package upgrades \figure/\table to real edge floats and adds in-flow figures the text flows around, all sharing one caption sequence (\caption, numbered on independent figure and table counters, filing into the lists of figures and tables).

CommandEffect
\figure[htb]{…} \table[htb]{…}detach the body to a page edge (here / top / bottom)
\wrapfigure{side}{width}{…} \wraptable{side}{width}{…}anchor the body at the margin (side = l/r); running text wraps beside it
\wrapfigure[shape]{side}{width}{…}wrap text along a non-rectangular silhouette (shape = ellipse/triangleup/triangledown/diamond/rect)
\caption{…}a numbered caption; the float it sits in decides whether it counts as a figure or a table

Captions file into the lists of figures and tables that document‘s \listoffigs / \listoftabs print, resolved on the second typesetting pass.

Chemistry (\use{chem})

CommandEffect
\ce{CH4 + 2 O2 -> CO2 + 2 H2O}a reaction equation (mhchem-style)
\dn{n} \up{n}formula subscript / superscript
\atom{name}{x y}{label}place and label an atom
\bond \dbond \tbondsingle / double / triple bond

Chess (\use{chess})

The package keeps a position and plays algebraic notation into it, so a diagram is what the moves before it reached. See the chess guide.

CommandEffect
\newgamethe initial array, White to move
\fenboard{fen}set a position from a FEN string (placement field, and side to move if given)
\mainline{moves}print a line of algebraic notation and play it
\hidemoves{moves}play a line without printing it
\showmoves{moves}print a line without playing it (a sideline)
\showboarddraw the current position as one picture box
\fendiagram{fen}\fenboard and \showboard together
\chessfenthe current position written back as FEN
\pieceat{sq}the piece letter on a square, FEN-cased, or .

Configured with \set after \use{chess}: chesssquare, chesscoords, chessflip, chesshighlight, chesslight, chessdark, chessborder, chesshighlightink, chesspieceink, chesspiecescale, chessfigurines, chessmovesize.

Plotting (\use{plot})

CommandEffect
\xrange{min}{max} \yrange{min}{max}the plot’s data ranges
\autorange{x y x y …}derive both ranges from the data
\xcategories{A B C …}name the x ticks instead of numbering them
\xlabel{…} \ylabel{…} \plottitle{…}axis labels and title
\xstep{s} \ystep{s}force a tick step (default: a nice step)
\xtickformat{pre}{suf} \ytickformat{pre}{suf}wrap numeric tick labels (e.g. \$, \%)
\plot{ … }draw the axes, ticks, grid, and labels, then the body’s series
\lineplot[colour][label]{x y x y …}a polyline through the data points
\scatter[colour][label]{x y x y …}a marker at each point (shape from plotmarkshape)
\bars[colour][label]{x y x y …}a vertical bar to each point (plotvalues labels them)
\areaplot[colour][label]{x y x y …}the band under the curve, filled to the baseline
\stepplot[colour][label]{x y x y …}a staircase holding each value to the next x
\fnplot[colour][label]{expr in x}a sampled curve of a function
\bubble[colour][label]{x y size …}a translucent disc at each point, sized by a third value
\errorbars[colour][label]{x y err …}a capped y ± err whisker at each point
\trendline[colour][label]{x y x y …}the least-squares line of best fit
\hline[colour]{y} \vline[colour]{x}a dashed reference line at a data value
\legend[ne\|nw\|se\|sw]draw a key for the labelled series

Both bracket arguments are optional: with no colour (or []) a series takes the next palette colour, and a label adds a legend entry.

Geographic maps (\use{map})

Draws maps over the \picture layer in the Web Mercator projection the OpenStreetMap tile ecosystem uses. You declare the geographic window in longitude/latitude with \mapbounds, then draw inside \map{…}, writing real coordinates everywhere — \place{35.23}{31.78}{Jerusalem} lands at the true point. Because Mercator is separable, the projection is two one-argument macros (\mapx, \mapy), parallel to plot‘s \px/\py. Base coastlines/rivers/land are far too dense to project a point at a time, so they are projected offline into a \basemap macro of pre-projected paths and \included beside the document; overlays and furniture are projected at run time and register exactly. While the package is loaded its \map{…} shadows the keyed-map \map.

CommandEffect
\mapbounds{lon0}{lat0}{lon1}{lat1}declare the window (south-west then north-east corner) and derive the projection
\map{ … }draw the map: the body holds the base linework, overlay, and furniture
\mapx{lon} \mapy{lat}project one coordinate to a page point (a number or a variable)
\place[anchor:auto]{lon}{lat}{name}a dot with a label at a coordinate
\marker[color:…]{lon}{lat} \label[anchor:center]{lon}{lat}{text}the dot or the label on its own
\route[color:…]{lon lat lon lat …}a polyline through a list of coordinates
\region[color:…]{lon lat lon lat …}a filled polygon through a list of coordinates
\graticule[step:1]a latitude/longitude grid every step degrees
\scalebar[km:50]{x}{y} \northarrow{x}{y}a scale bar / north arrow at a page position
\neatlinea border framing the map

The base file sets the size configuration and calls \mapbounds itself, so the offline linework and the run-time overlay cannot drift out of register.

Macros and programming

CommandEffect
\def name args {body}define a macro ([name:default] optional args, <name> a verbatim argument)
\newenvironment name {begin}{end}define a \begin/\end environment
\let \global \gdefaliasing and global definitions
\if \else \ficonditionals; \if, \while and \filter all test one rule — 0, false, an empty string or sequence and an unset name are false. In a value position an \if is worth the branch it chose
\ifx \a \bwhether two names mean the same thing — alike macros, a \let copy and its original, two names that mean nothing at all
\calc{…} \+ \- \* \/arithmetic
\round{value}{places}round a number to a fixed number of decimals
\= \!= \< \> \<= \>=comparisons (each yields a capturable boolean); \= compares sequences and maps by contents, and counts an unset name and an empty value as alike
\for … \doneiteration over a known sequence; in a value position it is worth the text it wrote
\while {condition} {body}iteration until a condition goes false, re-read each time
\the\nameoutput a variable’s value (\the\pageno, \the\hsize, …)
\seq{…} \words{s} \head \tail \last \size \cat \range{a}{b}sequences; \words splits on whitespace, \range counts ab, \last is the final element
\upcase{…} \downcase{…} \trim{…}uppercase / lowercase / strip surrounding whitespace
\map{…} \mapset \mapget \maphas \mapdelkeyed maps
\keys{map} \values{map}a map’s keys or values as a sequence

Working with sequences and strings

A string is the sequence of its characters, so these take either and give back the kind they were given. Characters means code points, so an emoji or a math alphanumeric is one item. A number counts as the characters it displays as, since a run of digits becomes a number as soon as it is stored — \size{12345} is 5 whether it is written out or read from a variable. Positions count from 1, and \indexof answers 0 for “not found” — which is falsy, so one call both tests and locates.

CommandEffect
\nth{items}{n}the nth item or character (Undefined past either end)
\slice{items}{from}{count}count items from position from, clamped at both ends
\reverse{items}the items in the opposite order
\append{seq}{item} \prepend{seq}{item}the sequence with one more item on either end
\put{items}{n}{value}the nth item replaced — the counterpart of \nth, and the only way to write at a position (out of range is an error, not a no-op)
\concat{a}{b}one sequence followed by another (\cat joins two values as text)
\join{seq}{sep} \split{text}{sep}sequence ↔ string, on a literal separator (empty splits into characters)
\chunk{seq}{n}the items grouped into sub-sequences of n — a flat x y x y list becomes pairs
\contains{items}{item}membership, or substring for a string
\indexof{items}{item}where it first occurs, counting from 1; 0 if absent
\total{seq} \minimum{seq} \maximum{seq}sum, least and greatest (\total, not \sum — that is the math operator)
\sort{seq}in order: numeric where the items are numbers, alphabetical where they are words
\replace{text}{from}{to}every occurrence, matched literally
\repeat{text}{n}the text n times over
\startswith{text}{s} \endswith{text}{s}test either end
\fixed{number}{places}exactly that many decimals, zeros kept (\round drops them)
\ord{char} \chr{n}a character’s Unicode code point and its inverse — the door between text and arithmetic

Three take a body evaluated once per item, binding a variable of your choosing exactly as \for does — the difference being that they collect the body’s value rather than typesetting its output, which is what lets a loop compute a result instead of accumulating through a \global variable:

CommandEffect
\filter \v {seq} {condition}the items for which the condition holds
\transform \v {seq} {expression}each item replaced by what the expression computes
\sortby \v {seq} {key}ordered by a key computed from each item (stable)
\set squares {\transform\n{\range{1}{4}}{\calc{\n * \n}}}      % 1, 4, 9, 16
\set big     {\filter\n{\squares}{\> {\n} {5}}}                  % 9, 16
\set byname  {\sortby\w{\words{Zebra apple Fig}}{\downcase{\w}}} % apple, Fig, Zebra

The body may be several statements, in which case its value is the last one that produced a value. That matters because \calc reads its argument as an expression string: a variable works there (\calc{\n * 2}), but a primitive call does not — \calc{\nth{\p}{1} * 2} reads \nth{\p}{1} as an identifier. Bind what you need first:

\set sxy {\total{\transform\p{\chunk{\data}{2}}%
  {\set x {\nth{\p}{1}}\set y {\nth{\p}{2}}\calc{x * y}}}}

| \message{…} | write expanded text to standard error (a diagnostic; no page output) | | \oklch{L}{C}{h} \oklchof{color} | build / read a colour in the Oklch space (lightness, chroma, hue) — derive shades by varying L | | \newcounter \setcounter \addtocounter \stepcounter \value \counterwithin | named counters; \counterwithin resets a child when its parent steps | | \arabic/\roman/\Roman/\alph/\Alph/\fnsymbol | format a number as digits / roman / letters / footnote symbols | | \use{name} \include{path} | load a format / include raw input | | \usfm{path} | typeset a Scripture file in USFM format through the \usfm… macros (\use{usfm}) |

Scripture (\use{usfm})

\usfm{path} reads a book in USFM (the Unified Standard Format Markers that Bible translations are exchanged in) and typesets it, resolving the path beside the document as \include does. Every visible decision is a redefinable macro, so a document sets the appearance with ordinary commands before the call — \def usfmwj t {\t} to drop the red-letter words of Jesus, \set usfmqbase {24} for a deeper poetry indent, and so on. The defaults give a print-Bible page: a large chapter figure, superscript verse numbers, bold section headings with italic reference lines, justified prose and ragged poetry, real footnotes, and the words of Jesus in red.

The reader handles the full USFM marker set — including USFM 3.0 word attributes and plus-nested character markers — and a book’s front-matter introduction (its own titles, outline, prose and poetry, set a size quieter than the Scripture). Suppress the introduction with \set usfmintro {0} before the call — a pocket portion that wants only the text needs no change to the USFM file.

MacroStyles
\usfmmt{n}{…} \usfms{n}{…} \usfmr{n}{…} \usfmd{n}{…}book title / section heading / reference line / psalm superscription
\usfmc{N} \usfmv{N}the chapter figure and the verse number
\usfmp{n} \usfmm{n} \usfmq{n} \usfmli{n} \usfmbindented / flush paragraph, poetry line by level, list item, stanza break
\usfmimt{n}{…} \usfmis{n}{…} \usfmiot{n}{…} \usfmio{n}{…} \usfmip{n} \usfmiq{n}introduction: title / heading / outline heading and entry / prose / poetry
\usfmwj{…} \usfmref{disp}{target} \usfmnd{…}words of Jesus, a cross-reference link, the name of God
\usfmfootnote{…} with \usfmfr \usfmft \usfmfqa \usfmfva footnote and its reference / text / alternative / verse-number parts

Railroad diagrams (\use{railroad})

CommandEffect
\railroad{ <grammar> }draw a railroad (syntax) diagram per rule from W3C-style EBNF

The grammar is read verbatim. Rules are name ::= expression; an expression supports \| (alternation), juxtaposition (concatenation), ?/*/+ (optional / zero-or-more / one-or-more), (…) grouping, "…"/'…' terminals (rounded boxes), […] character classes (pointed hexagons), and bare names as nonterminals (square boxes). Labels are set in JetBrains Mono with terminals in bold. Common shapes are drawn idiomatically: a separated list A (sep A)* becomes A with sep on a return loop, and an optional choice (A|B|C)? folds the skip into the choice. See the guide for customising colours and sizes.

Node-and-edge diagrams (\use{diagram})

Declared inside a \picture. A node is a named, measured box of a shape; an edge is an arrow between two named nodes that meets each node’s true boundary.

CommandEffect
\node [shape] {name} {placement} {label}a node; shape ∈ box, round, stadium, diamond, parallelogram, ellipse, circle, hexagon, subroutine (default box)
\edge [label] {from} {to}a straight arrow between two nodes
\link [label] {from} {to}a straight undirected line (no arrowhead)
\edgehv / \edgevh [label] {from} {to}an orthogonal arrow (across-then-down / down-then-across)
\cedge [bend] {from} {to} {label}a curved arrow, bowed by bend points
\loop {name} {label}a self-loop above a node
\dgentry {name} {dir} {len}a short entry stub pointing into a node

A placement is at X Y, at (X,Y), or below/above/left/right REF [gap] (relative to another node). The look is set with \set on the dg… variables (dgfill, dglinecolor, dgfont, dggap, dgarrow, …).

The flowchart package (\use{flowchart}) adds role names — \start \stop (terminal), \process (box), \decision (diamond), \io (parallelogram), \subroutine — and flow edges \flow / \branch / \rejoin. The automaton package (\use{automaton}) adds \state (circle), \accepting (double circle), \initial, \trans, \arc and \loopabove. The er package (\use{er}) draws Chen-notation entity-relationship diagrams — \entity, \weakentity, \relationship, \weakrelationship, \attribute, \keyattribute, \multivalued, \derived, and \connect / \connecttotal with cardinalities. All three are thin layers over diagram; see the guide.

Units

pt (the base unit, 1/72 in), in, cm, mm, em, ex.

Search

Esc
to navigate to open Esc to close