LATEX math,
resolved.
TeXForm parses, edits and normalizes LaTeX formulas as syntax trees.
Open source, with packages for Python, JavaScript and Rust.
{a \over b}+\sqrt {x^2} under corpus, precomputed by texform 0.10.1 until the live engine loads. Hover a character, node or token to trace it. Tinted marks show what changes.§1Parse. Edit. Transform.
Parse a formula once, then edit and transform the same tree.
1.1Parse
The parser turns LaTeX source into a syntax tree. It looks up each command in the knowledge base to find its arguments.
1.2Edit
The Document API finds, builds and replaces nodes, then writes the tree back to LaTeX.
1.3Transform
The transform engine rewrites the tree into a canonical form. A profile sets how much it changes.
§2Normalization
LaTeX lets the same formula be written in many ways. Normalization rewrites these variants into one form: aliases unified, convenience macros expanded, redundant braces removed. Most rewrites are named rules, and each profile enables the rules suited to one use.
\sum\limits_{i}\bigl(\dfrac{1}{x_i}\bigr)^{{2}} \not{=} {\bf y} under corpus. Flattening \not{=} creates a match for Rewrite, so the earlier phases run again. Tinted nodes are about to be replaced or were just added. Phase states are replayed from texform 0.10.1; rule order within a Rewrite pass is reconstructed.§3Knowledge base
The knowledge base records the syntax of LaTeX commands and environments: their arguments, modes and packages. The parser and the Document API both rely on it. Every entry is tested in three renderers and has its own reference page.
§4Get started in Python, JavaScript, Rust or the CLI
The same API in Python, JavaScript and Rust, built on a shared Rust core. The JavaScript package runs as WebAssembly, in the browser or in Node.js. The CLI brings the same normalization to the command line.
import texformsrc = r"{a \over b}+\sqrt {x^2}"engine = texform.TransformEngine(profile="corpus")engine.normalize(src)
import { TransformEngine } from "texform";const src = String.raw`{a \over b}+\sqrt {x^2}`;const engine = new TransformEngine({profile: "corpus" });engine.normalize(src);
use texform::{Profile, TransformEngine};let src = r"{a \over b}+\sqrt {x^2}";let engine = TransformEngine::builder().profile(Profile::Corpus).build()?;let out = engine.normalize(src)?;
texform normalize --profile corpus '{a \over b}+\sqrt {x^2}'
--lines, the CLI reads one formula per line. Command-line reference §5Applications
Pipelines that store, compare or render LaTeX math need it in a predictable form. Tools that edit it need its structure. TeXForm provides both.
References
Build on a foundation you can cite.
Open source under Apache-2.0, including its knowledge base and rewrite rules.
A paper describing TeXForm is coming soon. Until then, please cite the software.
@software{texform,author = {TeXForm contributors},title = {TeXForm: Parsing, Editing,and Normalizing LaTeX Math},url = {https://texform.dev},version = {0.10.1},year = {2026},}
TeXForm contributors. TeXForm: Parsing, Editing, and Normalizing LaTeX Math. Version 0.10.1, 2026. https://texform.dev