Skip to main content

Crate tex2math

Crate tex2math 

Source

Structs§

MathMLRenderer
The standard MathML rendering backend provided by tex2math.

Enums§

LimitBehavior
Specifies the rendering behavior of limits (subscripts and superscripts) for operators.
MathNode
The Abstract Syntax Tree (AST) node representing a mathematical structure parsed from LaTeX.
RenderMode
The rendering mode for the mathematical formula.

Traits§

MathRenderer
An abstract backend interface for rendering a MathNode abstract syntax tree into an output format.

Functions§

generate_mathml
A convenience function to generate MathML from a MathNode AST directly.
parse_atom
Parses an atomic mathematical element, which can be a number, identifier, operator, group, or command.
parse_command
Parses a general LaTeX command starting with a backslash (e.g., \alpha, \int, \mathbf{x}).
parse_environment
Parses a LaTeX environment enclosed in \begin{env} and \end{env} (e.g., matrix, cases).
parse_fraction
Parses LaTeX fractions like \frac{num}{den}, \dfrac{num}{den}, and \tfrac{num}{den}.
parse_group
Parses a grouped expression enclosed in curly braces ({...}) into a MathNode::Row or a single node.
parse_ident
Parses a single alphabetic character as an identifier into a MathNode::Identifier.
parse_left_right
Parses dynamically sized fences like \left( ... \right).
parse_node
The main parser for a single mathematical node, handling scripts, atoms, and other constructs.
parse_number
Parses a numeric literal (e.g., 123, 3.14) into a MathNode::Number.
parse_operator
Parses common mathematical operators (e.g., +, -, =, !) into a MathNode::Operator.
parse_row
Parses a sequence (row) of mathematical nodes, optionally separated by spaces.
parse_script
Parses subscripts (_) and superscripts (^) attached to a base mathematical element.
parse_sqrt
Parses a square root or nth root like \sqrt{x} or \sqrt[n]{x}.