pub enum MathNode {
Show 34 variants
Atom(char, AtomKind),
Fraction(Box<MathNode>, Box<MathNode>),
Radical(Option<Box<MathNode>>, Box<MathNode>),
Superscript(Box<MathNode>, Box<MathNode>),
Subscript(Box<MathNode>, Box<MathNode>),
SubSup(Box<MathNode>, Box<MathNode>, Box<MathNode>),
Delimited(Delimiter, Box<MathNode>, Delimiter),
SizedDelim(Delimiter, DelimSize, AtomKind),
Row(Vec<MathNode>),
Matrix(MatrixStyle, Vec<ColSpec>, Vec<EnvRow>),
Substack(Vec<MathNode>),
Ref(String),
Tag {
star: bool,
body: Box<MathNode>,
},
Label(String),
NoNumber,
Hline,
Intertext(Box<MathNode>),
Sum(Option<Box<MathNode>>, Option<Box<MathNode>>),
Integral(IntegralKind, Option<Box<MathNode>>, Option<Box<MathNode>>),
Product(Option<Box<MathNode>>, Option<Box<MathNode>>),
Limit(Option<Box<MathNode>>),
OverUnder(Box<MathNode>, Option<Box<MathNode>>, Option<Box<MathNode>>),
Accent(Box<MathNode>, AccentKind),
CancelTo(Box<MathNode>, Box<MathNode>),
Text(String, TextStyle),
Space(SpaceKind),
Operator(String, bool),
Symbol(String),
Color(Color, Box<MathNode>),
TextColor(Color, Box<MathNode>),
ColorBox(Color, Box<MathNode>),
FColorBox(Color, Color, Box<MathNode>),
Strut(Dim, Dim),
Phantom(PhantomKind, Box<MathNode>),
}Expand description
Typed math-mode syntax tree.
Produced by crate::parse(). MathNode::gold is the gold-stable debug form.
§Examples
use latex_rust::parse;
let n = parse("x^2").unwrap();
assert!(n.gold().contains("sup"));Variants§
Atom(char, AtomKind)
Single character with a TeX atom class.
Fraction(Box<MathNode>, Box<MathNode>)
\frac / \dfrac / \tfrac / \cfrac / {a \over b}.
Radical(Option<Box<MathNode>>, Box<MathNode>)
\sqrt / \sqrt[n]. Index None is a square root.
Superscript(Box<MathNode>, Box<MathNode>)
x^{}
Subscript(Box<MathNode>, Box<MathNode>)
x_{}
SubSup(Box<MathNode>, Box<MathNode>, Box<MathNode>)
x_{}^{}
Delimited(Delimiter, Box<MathNode>, Delimiter)
\left ... \right
SizedDelim(Delimiter, DelimSize, AtomKind)
\big / \Big / \bigg / \Bigg (and l/r/m forms).
Row(Vec<MathNode>)
Horizontal list of nodes.
Matrix(MatrixStyle, Vec<ColSpec>, Vec<EnvRow>)
Matrix or multiline environment. colspec is the {array} preamble (empty otherwise).
Substack(Vec<MathNode>)
\substack{...} — stacked script-style lines.
Ref(String)
\ref{key}
Tag
\tag{...} / \tag*{...} (peeled into EnvRow when inside an environment).
Label(String)
\label{key}
NoNumber
\nonumber / \notag
Hline
\hline (peeled into EnvRow::Hline in environments).
Intertext(Box<MathNode>)
\intertext{...}
Sum(Option<Box<MathNode>>, Option<Box<MathNode>>)
\sum with optional lower / upper limits.
Integral(IntegralKind, Option<Box<MathNode>>, Option<Box<MathNode>>)
\int family with optional limits.
Product(Option<Box<MathNode>>, Option<Box<MathNode>>)
\prod with optional limits.
Limit(Option<Box<MathNode>>)
\lim with optional subscript.
OverUnder(Box<MathNode>, Option<Box<MathNode>>, Option<Box<MathNode>>)
\overset / \underset / \stackrel (base, over, under).
Accent(Box<MathNode>, AccentKind)
Accent or decoration on a nucleus.
CancelTo(Box<MathNode>, Box<MathNode>)
\cancelto{value}{expr}
Text(String, TextStyle)
Styled character run (\mathrm, \text, …).
Space(SpaceKind)
Explicit math skip.
Operator(String, bool)
Named operator (\sin). The flag is \limits vs \nolimits.
Symbol(String)
Named glyph (\alpha, \times). The string is the control-sequence name.
Color(Color, Box<MathNode>)
\color applied to a following math list.
TextColor(Color, Box<MathNode>)
\textcolor{...}{...}
ColorBox(Color, Box<MathNode>)
\colorbox{...}{...}
FColorBox(Color, Color, Box<MathNode>)
\fcolorbox{border}{fill}{body}
Strut(Dim, Dim)
Vertical strut (height, depth) in em.
Phantom(PhantomKind, Box<MathNode>)
\phantom family.