Skip to main content

Text and inline elements

Text lives in a text block: <p>, <h1>–<h6>, or <caption>. A block may contain plain text, interpolations, inline elements and inline math.

<p>Neighbours are stored differently <a to="jin2026">Jin et al. (2026)</a>,
and the estimate <span font-style="italic">S</span><sub>i</sub> must be
recomputed.</p>

The text block​

TagDefault sizeDefault leading
p10 pt1.2
h117 pt1.15
h214 pt1.15
h312 pt1.15
h411 pt1.15
h510.5 pt1.15
h610 pt1.15
caption8.5 pt1.2
cell9 pt1.2

Sizes and leadings are overridden by the tag's attributes, then by a project default for that tag, then by the engine value above.

Block attributes​

AttributeValueNotes
font-sizenumberPoints, always — ignores unit
leadingnumberMultiple of this tag's font size
alignleft, center/centre, right, justify
colorcolourAny sRGB colour, alpha included
font-familyfamily nameMust be declared in font.faces
font-weightnormal, bold, or 1–1000
font-stylenormal, italic, oblique
letter-spacingnumber (points) or "0.08em"An em value is relative to the text size
indentlengthFirst-line offset
hanginglengthLater-line offset
space-beforelengthSpace above the block
unitmm (default), cm, in, pt, pc, pxApplies only to lengths written on this tag
idstringA link target and a place for label()

indent and hanging are alternatives. Stating both is an error (indent-hanging), not a precedence rule.

<p align="justify" indent={4}>The first line starts four millimetres in.</p>
<p hanging={4}>The first line is flush; later lines are offset.</p>
<p color="rgb(200 40 20 / 70%)" letter-spacing="0.04em">Warmer, and slightly open.</p>

Inline elements​

TagEffect
<a to="id">Internal link; destination resolved after drawing
<a href="url">External link
<span>Carries text attributes for a run
<b>, <strong>Weight 700
<i>, <em>Italic
<small>85% of the inherited size
<mark>Accepted, no appearance of its own
<sup>70% size, raised by 0.33 em
<sub>70% size, lowered by 0.33 em
<footnote>A raised marker and an entry in the page's note area
$…$Inline math

<span> accepts font-size, color, letter-spacing, font-family, font-weight, font-style, offset and unit. offset raises or lowers the run in the current unit.

<caption labelled-by="tab-time">Table {tables["tab-time"].label}. Measured <sup>1</sup> on one socket.</caption>
No arithmetic in an attribute

An attribute value is an expression. Expressions are literals, identifiers, object and array literals, field access, indexing and calls to the core functions — no operators. Write {12} or {config.size}, not {10 + 2}.

Lines, breaks and hyphenation​

Line breaking is decided by compile with a greedy fit, never by the renderer. Whitespace collapses; a line ends between words, never inside one unless hyphenation supplies a break.

Hyphenation has two sources, both in config:

  • hyphenation.words — words with explicit break points, written hy-phen-ation (an array, or an object keyed by the word);
  • hyphenation.auto — the embedded English (US) Knuth–Liang patterns.

A literal hyphen in a word is always a break point. A word with no break point stays whole; if it cannot fit, it is clipped and reported rather than split arbitrarily.

Justification grows the spaces between words. If a line's gaps must exceed 2.5× the natural space, the line is still set justified and reported as loose-line:

warning[loose-line]: a justified line needs word gaps wider than the engine allows
--> paper.mtx:88:17
= help: shorten the measure or add the words to the hyphenation list

Colour​

A colour is any of:

color="navy" // a named colour
color="#b23a24" // #rgb, #rrggbb or #rrggbbaa
color="rgb(178 58 36)" // components 0–255, or percentages
color="rgb(178 58 36 / 60%)" // with alpha

Named values: black, white, red, green, blue, navy, gray/grey, silver, maroon, olive, teal, purple. An unparseable colour is ignored rather than guessed.

Faces, not synthetic styles​

<b> asks the family for weight 700 and <i> asks it for italic. The engine draws the face that matches; it never synthesises a bold or a slant. If the family has no such face, the request falls back to the nearest declared face.

Small caps are a face, not a switch. Name a face whose lowercase letters are small capitals and select it with font-family; use letter-spacing for tracking.

Text in the static dialect​

compile lowers <p> and the inline sugar into <line> and <span>. A static line has a fixed height, a space-before, an optional width, and one <span> per run with an optional x. This is what render draws; it does no line breaking of its own.