pub enum Node {
Text(String, Span),
ParagraphBreak(Span),
Command {
name: String,
args: Vec<Arg>,
span: Span,
},
Group(Vec<Node>, Span),
Math(Vec<Node>, Span),
DisplayMath(Vec<Node>, Span),
Comment(String, Span),
AlignTab(Span),
Tilde(Span),
Environment {
name: String,
args: Vec<Arg>,
body: Vec<Node>,
span: Span,
},
}Expand description
A single node in the LaTeX AST.
Variants§
Text(String, Span)
A run of plain text characters
ParagraphBreak(Span)
A blank line in the source - signals a paragraph break.
Command
A LaTeX command and its arguments, e.g. \textbf{hello}.
Group(Vec<Node>, Span)
A braced group {...}.
Math(Vec<Node>, Span)
Inline match: $ ... $. The span covers both $ delimiters.
DisplayMath(Vec<Node>, Span)
Display math: \[ ... \]. The span covers both delimiters.
Comment(String, Span)
A % ... line comment. THe string is the body without the leading
% and without the trailing newline - the span covers the whole
run, including both. Comments in AST since they can actually affect produced PDF.
AlignTab(Span)
A & column separator inside tabular/array/align and other environments.
Tilde(Span)
A ~ - a non-breaking space. Acts like a regular space for layout
but forbids a line break at this point.
Environment
\begin{name} ... \end{name}. args is everything after the
environment name (optionals and additional mandatory groups). body
holds the parsed children; the span also covers the entire construct.