ParseNode

Type Alias ParseNode 

Source
pub type ParseNode = AnyParseNode;
Expand description

Primary type alias for all parse nodes in the KaTeX AST.

This is the main type used throughout the KaTeX parsing and rendering pipeline to represent mathematical expressions. It is equivalent to AnyParseNode and provides a more convenient name for the core AST node type.

§Architecture

The parse node system uses an enum-based approach where each variant represents a different type of mathematical construct, from simple symbols to complex structures like fractions and arrays.

§Usage

This type is used extensively in:

  • Parser output - the result of parsing LaTeX input
  • AST transformations - modifying or analyzing the parse tree
  • Rendering pipeline - converting to visual output
  • Type checking and validation - ensuring correct node types

§See Also

Aliased Type§

pub enum ParseNode {
Show 58 variants Array(ParseNodeArray), OrdGroup(ParseNodeOrdGroup), SupSub(ParseNodeSupSub), Genfrac(Box<ParseNodeGenfrac>), LeftRight(ParseNodeLeftRight), LeftRightRight(ParseNodeLeftRightRight), Sqrt(Box<ParseNodeSqrt>), Atom(ParseNodeAtom), MathOrd(ParseNodeMathOrd), Op(ParseNodeOp), Spacing(ParseNodeSpacing), Text(ParseNodeText), Styling(ParseNodeStyling), Font(ParseNodeFont), Color(ParseNodeColor), Accent(Box<ParseNodeAccent>), Overline(ParseNodeOverline), Underline(ParseNodeUnderline), Phantom(ParseNodePhantom), Hphantom(ParseNodeHphantom), Vphantom(ParseNodeVphantom), Rule(ParseNodeRule), CdLabel(ParseNodeCdLabel), CdLabelParent(ParseNodeCdLabelParent), ColorToken(ParseNodeColorToken), Raw(ParseNodeRaw), Size(ParseNodeSize), Tag(ParseNodeTag), Url(ParseNodeUrl), Verb(ParseNodeVerb), TextOrd(ParseNodeTextOrd), AccentToken(ParseNodeAccentToken), OpToken(ParseNodeOpToken), AccentUnder(Box<ParseNodeAccentUnder>), Cr(ParseNodeCr), Delimsizing(ParseNodeDelimsizing), Enclose(ParseNodeEnclose), Environment(Box<ParseNodeEnvironment>), Hbox(ParseNodeHbox), HorizBrace(ParseNodeHorizBrace), Href(ParseNodeHref), Html(ParseNodeHtml), HtmlMathMl(ParseNodeHtmlMathMl), Includegraphics(ParseNodeIncludegraphics), Infix(ParseNodeInfix), Internal(ParseNodeInternal), Kern(ParseNodeKern), Lap(ParseNodeLap), MathChoice(ParseNodeMathChoice), Middle(ParseNodeMiddle), Mclass(ParseNodeMclass), OperatorName(ParseNodeOperatorName), Pmb(ParseNodePmb), Raisebox(ParseNodeRaisebox), Sizing(ParseNodeSizing), Smash(ParseNodeSmash), Vcenter(ParseNodeVcenter), XArrow(ParseNodeXArrow),
}

Variants§

§

Array(ParseNodeArray)

§Structural Nodes

Array/matrix environments with rows and columns

§

OrdGroup(ParseNodeOrdGroup)

Ordered groups of expressions (parentheses, etc.)

§

SupSub(ParseNodeSupSub)

Superscript/subscript combinations

§

Genfrac(Box<ParseNodeGenfrac>)

Generalized fractions (fractions, binomials)

§

LeftRight(ParseNodeLeftRight)

Left-right delimiter pairs

§

LeftRightRight(ParseNodeLeftRightRight)

Right delimiters in left-right delimiter pairs (\left…\right).

§

Sqrt(Box<ParseNodeSqrt>)

Square roots and nth roots

§

Atom(ParseNodeAtom)

§Symbol Nodes

Atomic symbols with specific mathematical meaning

§

MathOrd(ParseNodeMathOrd)

Ordinary mathematical symbols

§

Op(ParseNodeOp)

Mathematical operators

§

Spacing(ParseNodeSpacing)

Explicit spacing elements

§

Text(ParseNodeText)

§Text and Styling

Text content within math

§

Styling(ParseNodeStyling)

Style changes (bold, italic, etc.)

§

Font(ParseNodeFont)

Font family changes

§

Color(ParseNodeColor)

Color specifications

§

Accent(Box<ParseNodeAccent>)

§Functions and Commands

Accents over symbols (hats, bars, etc.)

§

Overline(ParseNodeOverline)

Horizontal lines on top of expressions

§

Underline(ParseNodeUnderline)

Horizontal lines below expressions

§

Phantom(ParseNodePhantom)

Invisible content for spacing or alignment

§

Hphantom(ParseNodeHphantom)

Horizontal phantom content for spacing (\hphantom{…}).

§

Vphantom(ParseNodeVphantom)

Vertical phantom content for spacing (\vphantom{…}).

§

Rule(ParseNodeRule)

Horizontal/vertical rules

§

CdLabel(ParseNodeCdLabel)

§Miscellaneous Nodes

Labels for arrows in commutative diagram environments (\begin{CD}…\end{CD}).

§

CdLabelParent(ParseNodeCdLabelParent)

Parent containers for CD labels in commutative diagrams.

§

ColorToken(ParseNodeColorToken)

Color tokens for setting current color context (\color{name}).

§

Raw(ParseNodeRaw)

Raw content passed through without mathematical processing.

§

Size(ParseNodeSize)

Size specifications for spacing and dimensions (\rule, spacing commands).

§

Tag(ParseNodeTag)

Tagged equations with labels (\tag{label} or automatic numbering).

§

Url(ParseNodeUrl)

Hyperlinks in mathematical expressions (\url{…}).

§

Verb(ParseNodeVerb)

Verbatim text preserving exact formatting (\verb|text| or \begin{verbatim}…\end{verbatim}).

§

TextOrd(ParseNodeTextOrd)

Ordinary text symbols in math mode (letters, punctuation).

§

AccentToken(ParseNodeAccentToken)

Accent symbols for diacritical marks (\hat, \bar, \tilde, etc.).

§

OpToken(ParseNodeOpToken)

Operator symbols with special positioning (\sum, \int, \lim, etc.).

§

AccentUnder(Box<ParseNodeAccentUnder>)

Accent marks placed below expressions (\underline, \underbar, etc.).

§

Cr(ParseNodeCr)

Carriage returns and line breaks (\, \newline).

§

Delimsizing(ParseNodeDelimsizing)

Delimiter sizing for proper enclosure (\big, \Big, \bigg, etc.).

§

Enclose(ParseNodeEnclose)

Enclosed expressions with styling (\boxed, \colorbox, etc.).

§

Environment(Box<ParseNodeEnvironment>)

Custom mathematical environments (\begin{env}…\end{env}).

§

Hbox(ParseNodeHbox)

Horizontal boxes for grouping content (\hbox{…}).

§

HorizBrace(ParseNodeHorizBrace)

Horizontal braces above/below expressions (\overbrace, \underbrace).

§

Href(ParseNodeHref)

Hyperlinks with custom text (\href{url}{text}).

§

Html(ParseNodeHtml)

Embedded HTML content within math expressions.

§

HtmlMathMl(ParseNodeHtmlMathMl)

Content renderable in both HTML and MathML formats.

§

Includegraphics(ParseNodeIncludegraphics)

Included graphics/images (\includegraphics{…}).

§

Infix(ParseNodeInfix)

Custom infix operators between operands.

§

Internal(ParseNodeInternal)

Internal parser nodes for implementation details.

§

Kern(ParseNodeKern)

Explicit kerning/spacing adjustments (\kern, \mkern).

§

Lap(ParseNodeLap)

Overlapping content for annotations (\rlap, \llap, \clap).

§

MathChoice(ParseNodeMathChoice)

Different renderings for display/text/script modes (\mathchoice{…}{…}{…}{…}).

§

Middle(ParseNodeMiddle)

Middle delimiters in expressions (\middle|).

§

Mclass(ParseNodeMclass)

Math class specifications for spacing and rendering (mord, mbin, mrel, etc.).

§

OperatorName(ParseNodeOperatorName)

Operator names with special formatting (\operatorname{…}).

§

Pmb(ParseNodePmb)

Poor man’s bold text formatting (\pmb{…}).

§

Raisebox(ParseNodeRaisebox)

Raised or lowered content (\raisebox{…}{…}).

§

Sizing(ParseNodeSizing)

Size changes for expressions (\scriptsize, \large, etc.).

§

Smash(ParseNodeSmash)

Smashed content ignoring height/depth (\smash{…}).

§

Vcenter(ParseNodeVcenter)

Vertically centered content (\vcenter{…}).

§

XArrow(ParseNodeXArrow)

Extensible arrows with labels (\xleftarrow{…}, \xrightarrow{…}).