math_spec.typeset.typst
Typst. The format that compiles without a toolchain.
Here to keep :mod:math_spec.typeset.format honest: a seam with one
implementation behind it is a shape, not an abstraction. Typst's syntax differs
from LaTeX's in every respect that matters — sum_(…), cal(T),
function-call grouping instead of brace groups, a term list instead of a
description environment — so if the walk needed changing to accommodate it,
the split was in the wrong place.
Practically: the compiler is one self-contained binary (a pip wheel, so the
suite compiles every example without apt), and multi-letter identifiers in math
are upright by default, which is why names go through italic("…").
TypstFormat
#
See :class:math_spec.typeset.format.Format.
The cyclic operators spell with .o, Typst's circled modifier;
minus.circle does not compile.
dash = '---'
class-attribute
#
notation = 'typst'
class-attribute
#
operators = {'cdot': 'dot', 'plus': '+', 'minus': '-', 'equal': '=', 'le': '<=', 'ge': '>=', 'lt': '<', 'gt': '>', 'ne': '!=', 'in': 'in', 'and': 'and', 'or': 'or', 'not': 'not', 'true': 'top', 'false': 'bot', 'forall': 'forall', 'such_that': 'colon', 'infinity': 'infinity', 'minus_infinity': '-infinity', 'cyclic_minus': 'minus.o', 'cyclic_plus': 'plus.o', 'edge_minus': 'minus.square', 'edge_plus': 'plus.square', 'times': 'times', 'maps_to': 'arrow.r', 'reals': 'RR', 'integers': 'ZZ', 'binary_set': '{0, 1}', 'sos_set': 'upright("SOS")', 'position': 'upright("pos")', 'minimize': 'min', 'maximize': 'max'}
class-attribute
#
suffix = '.typ'
class-attribute
#
apply(function, argument)
#
f(x) in Typst math is a call on f.
With an upright("bus") head that is exactly the notation wanted,
and it needs no thin space.
Source code in src/math_spec/typeset/typst.py
cardinality(inner)
#
cases(arms)
#
document(blocks, *, standalone)
#
Join the blocks; standalone only decides whether page setup is emitted.
Typst has no preamble/body split — a bare fragment is already a document.
Source code in src/math_spec/typeset/typst.py
equations(lines, *, numbered)
#
A block equation, aligned on &.
Typst aligns on & inside a block equation exactly as amsmath
does, so the :class:Line split carries over unchanged — which is
the point.