pub enum NodeKind {
Show 30 variants
List(Vec<Node>),
Symbol {
ch: char,
class: AtomClass,
},
BigOp {
ch: char,
limits: Limits,
integral: bool,
},
OpName {
name: String,
limits: bool,
},
Scripts {
base: Option<Box<Node>>,
sub: Option<Box<Node>>,
sup: Option<Box<Node>>,
primes: Vec<Span>,
},
Frac {
num: Box<Node>,
den: Box<Node>,
spec: FracSpec,
},
Radical {
index: Option<Box<Node>>,
radicand: Box<Node>,
},
Accent {
accent: AccentKind,
base: Box<Node>,
},
LeftRight {
left: Delim,
right: Delim,
body: Vec<Node>,
},
SizedDelim {
size: DelimSize,
class: AtomClass,
delim: Delim,
},
Text {
body: Vec<Node>,
},
TextRun {
text: String,
char_spans: Vec<Span>,
},
TextStyled {
style: TextStyle,
body: Vec<Node>,
},
MathIsland {
body: Vec<Node>,
display: bool,
},
StyleChange(Style),
AlignChange(LineAlign),
SizeChange(f64),
ColorChange(String),
LineSpacing(f64),
MathFont {
font: MathFont,
body: Box<Node>,
},
Phantom {
kind: PhantomKind,
body: Box<Node>,
},
Stack {
kind: StackKind,
annotation: Box<Node>,
base: Box<Node>,
},
XArrow {
mapsto: bool,
above: Box<Node>,
below: Option<Box<Node>>,
},
Space(SpaceKind),
Tie,
Linebreak,
AlignTab,
AlignBlock {
align: LineAlign,
lines: Vec<Node>,
},
Environment {
name: String,
spec: Option<String>,
rows: Vec<Vec<Node>>,
},
Fragment(FragmentKind),
}Expand description
What a node is. See the module docs; every variant is produced by
crate::parse / crate::parse_text with full span provenance.
Variants§
List(Vec<Node>)
A horizontal list: a group’s content, a cell, an argument, or the whole formula.
Symbol
A single character atom, already mapped to its math codepoint
(- ⇒ −, * ⇒ ∗, \pi ⇒ π). class is the intrinsic atom
class before contextual Bin→Ord degradation.
BigOp
A big operator (\sum, \int, …): an Op atom with a limits mode.
Fields
OpName
A roman operator name (\sin, \lim, \operatorname{…}): an Op
atom set in upright text.
Fields
Scripts
Sub/superscripts and primes attached to a base atom. base is
None when the script opens the list (TeX’s empty-nucleus atom).
Fields
Frac
A generalized fraction: \frac-family, \binom/\choose, or an
infix \over that split its enclosing list.
Fields
Radical
\sqrt, with an optional index (\sqrt[3]{x}).
Accent
An accented atom.
LeftRight
\left … \right: an Inner atom.
Fields
SizedDelim
A fixed-size delimiter (\big(, \Big\{, …).
Fields
Text
\text{…} inside mathematics: the body is text-mode content.
TextRun
A literal run of text-mode characters, with one source span per
character (decoded characters and source bytes are not linear:
escapes decode two bytes to one character, whitespace collapses) —
the provenance Text[3:7]-style slicing consumes.
TextStyled
A \textbf/\emph/\underline styling island (text mode, or the
LaTeX text-in-math form).
MathIsland
$…$ (or $$…$$) inside text mode: the body is math-mode
content.
Fields
StyleChange(Style)
A style-switch marker (\displaystyle …) applying to the remainder
of the enclosing list.
AlignChange(LineAlign)
A line-alignment declaration (\centering): applies to the
remainder of the enclosing list, exiting at group end, exactly like
LaTeX’s paragraph declarations. Produces no glyphs of its own.
SizeChange(f64)
A size declaration (\small, \Large, …): sets the current size
factor for the remainder of the enclosing list, exiting at group
end, and composing multiplicatively with the script styles (the
LaTeX 10 pt ladder of size10.clo).
ColorChange(String)
A \color{…} marker applying to the remainder of the enclosing
group. The argument is kept verbatim.
LineSpacing(f64)
A line-spacing declaration (\doublespacing): multiplies the
\baselineskip of subsequent \\-stacked lines in the enclosing
multi-line list (setspace’s \baselinestretch, 10 pt ladder value).
Produces no glyphs; inert inside grids, whose row rule is the
environment’s own.
MathFont
A math-alphabet command applied to one argument.
Phantom
A phantom box.
Stack
\stackrel/\overset/\underset.
Fields
XArrow
\xrightarrow[below]{above} / \xmapsto[below]{above}: a drawn
arrow stretched to its script-style labels, spaced as a relation.
Fields
Space(SpaceKind)
An explicit spacing command.
Tie
~ — a tie (non-breaking interword space).
Linebreak
\\ — a line break (or, at an environment’s own level, the row
separator, in which case it is consumed by the environment).
AlignTab
& — an alignment tab (or, at an environment’s own level, the cell
separator, in which case it is consumed by the environment). Kept as
a node at the top level because the Tex surface wraps whole strings
in an align*-class environment.
AlignBlock
A line-alignment environment (flushleft, center, flushright):
a text-mode block whose \\-split lines are aligned within the
widest line’s width. Lines are NodeKind::List nodes.
Environment
A \begin{name} … \end{name} environment. Cells are
NodeKind::List nodes.
Fields
Fragment(FragmentKind)
A structural fragment: the Tex surface’s multi-argument idiom makes
each literal argument its own corpus string, so a piece may be a
substring of a balanced whole ("{a", "b}", "\right)"). The
grammar accepts these at the top level and marks them explicitly —
never silently.