math_spec.typesetting.walk
The walk: resolved tree → typeset lines. Written once, for every format.
Everything here is a decision about the math — where a bracket changes the reading, which dimension a reduction binds, that a mask belongs on the ∀ rather than in the equation, that a translation shows at the leaf it re-indexes. None of it is about syntax, so none is duplicated per format.
AlignedComparison = ParameterComparison | ExpressionComparison | CountComparison | DimensionComparison | DimensionPosition | RelationComparison | RelationPairComparison
module-attribute
#
PositionForm = Literal['plain', 'grouped', 'from_end']
module-attribute
#
TranslationPolicy = Literal['plain', 'wrap', 'edge']
module-attribute
#
Noticed(policies=set(), grouped=False, positions=set(), numeric_coordinates=set())
dataclass
#
What the equations printed that the legend has to explain.
Walk(schema, symbols, fmt, *, inline_expressions=False)
#
Walks a validated schema, emitting :class:Lines in one format.
:meth:equations prints every section and returns what it :class:Noticed;
the legend methods take that record, so they can only describe symbols the
equations printed.
Source code in src/math_spec/typesetting/walk.py
format = fmt
instance-attribute
#
frames = {name: self._frame_of(name) for name in schema.expressions}
instance-attribute
#
inline_expressions = inline_expressions
instance-attribute
#
noticed = Noticed()
instance-attribute
#
schema = schema
instance-attribute
#
symbols = symbols
instance-attribute
#
convention_notes()
#
What the two faces mean, with the model's own symbols.
Only where the model has both, and quoting only derived symbols: a table is the author's to write, so a symbol it supplies is not one this note governs.
Source code in src/math_spec/typesetting/walk.py
definition(name)
#
The line defining one named expression, symbol = body over its frame.
Source code in src/math_spec/typesetting/walk.py
equations()
#
Every titled section of equations, and what printing them noticed for the legend.
Source code in src/math_spec/typesetting/walk.py
glossaries(noticed)
#
Source code in src/math_spec/typesetting/walk.py
line(name)
#
The one line name prints as: a named expression, a constraint, an assumption, a curve, or a variable's domain.
name is one of the five; :func:~math_spec.typesetting.typeset_declaration
refuses the rest, and a name declared as two of them. An assumption is
looked up where the document prints it from, so a condition a curve's
method states is a line a reader can ask for before the curve is
written out.
Source code in src/math_spec/typesetting/walk.py
position_notes(noticed)
#
A sentence for each positional symbol the model printed; the first says which of pos(t) and t is the position.
Source code in src/math_spec/typesetting/walk.py
sides(node, ctx)
#
One comparison as its two sides, the relation symbol leading the right.
Split so that a line whose whole predicate is one comparison aligns on the relation, as a constraint does.
Source code in src/math_spec/typesetting/walk.py
translation_notes(noticed)
#
A sentence for each translation symbol the model printed; plain t-k needs none.