Skip to main content

Module source

Module source 

Source
Expand description

The source walk of the math-passthrough feature and the bodies of its rules that stage flm.pres.math-passthrough: the rule of the math groups (\(…\), \[…\]), the rule of the display-math environments, and the rule of an opaque command lowered on its own.

Each rule stages (builds into the lowered tree; see Lowerer) one flm.pres.math-passthrough node whose body is the source the author wrote, in order and unchanged, except that every text command becomes content: a flm.pres.math-text node holding the command’s argument lowered as inline content, and that \ensuremath{…} inside a formula is written as its argument’s content, the command left out (ensuremath). A backend that writes flm.pres.math-passthrough natively (the three standard backends do) needs no rule of its own; on the latex-recomposed backend the feature’s rules of super::latex are chosen instead.

The rule of the display-math environments reads the line anchors and the line numbers through the library of the math feature (line_frames, stage_tag_content), which owns the equation lines, their reference points and their numbering, and writes each line’s content under that library’s newline rule (the module documentation of latex, The newline rule), so that a \label, \tag or \nonumber taken off a line of its own leaves no blank line in the formula’s source: the run of whitespace that ends a line’s content is written after the line’s tag and its \\.

Structs§

EnvironmentRule
The body of ENVIRONMENT_RULE: it stages a displayed flm.pres.math-passthrough node that carries the environment’s name, over the environment’s equation lines: for each line, an empty flm.pres.math-text node carrying the line’s anchor, the line’s source, the line’s tag or number, its \\ when another line follows, and the run of whitespace that ended the line’s source. A line’s \label and \nonumber are not written: they are data of the line, which the math feature has already read.
MathRule
The body of MATH_RULE: it stages a flm.pres.math-passthrough node over the math group’s nodes, displayed for \[…\] and inline for \(…\). Every text command inside the group, at any depth, becomes a flm.pres.math-text node (see the module documentation).
OpaqueRule
The body of OPAQUE_RULE: it stages a flm.pres.math-passthrough node over a copy of the opaque node, displayed when the nearest math group that contains the node is displayed and inline otherwise.