latex2ast: Extract the AST of a LaTeX formula.

View source: R/latexr.R

latex2astR Documentation

Extract the AST of a LaTeX formula.

Description

Runs the same scanning and parsing pipeline used by latex2r(), but returns the parsed abstract syntax tree instead of the R translation. Useful for debugging formulas and for tooling that wants to inspect the structure recognized by the parser.

Usage

latex2ast(x)

Arguments

x

string

Value

An Expr object, or NULL (invisibly) when the formula can't be scanned.

Examples

latex2ast("\\beta_1^{2}")

latexr documentation built on Sept. 30, 2026, 5:08 p.m.