RaTeX parses and lays out KaTeX-compatible math in Rust for native mobile, Flutter, WebAssembly, and server PNG, SVG, or PDF output.
Overview
RaTeX is a math rendering engine implemented in pure Rust without JavaScript, WebView, or DOM dependencies. It targets KaTeX-compatible math syntax and produces output through a shared display list that native canvases, WASM, and server rasterizers can consume with aligned results across platforms.
The pipeline covers lexer, parser, layout, and font metrics crates, with optional mhchem chemistry via \ce and \pu, physics units, proof trees in a bussproofs-style subset, and documented gaps versus KaTeX for trust-style HTML commands. CLI binaries render formulas to PNG, SVG, or PDF, with optional embedded KaTeX fonts and Unicode fallback discovery on Linux, macOS, and Windows.
Platform bindings ship for iOS, Android, Flutter, React Native, and web via WASM and a web component. Server and CI use standalone render binaries rather than headless browsers. The project compares itself to KaTeX for web-only workloads while emphasizing native surfaces and predictable memory without a JS runtime.
Developers can integrate through C ABI, Dart FFI, Swift, Kotlin JNI, npm WASM packages, or Rust crates depending on target. Golden tests and live demos document syntax coverage relative to KaTeX references.
Key features
- Pure Rust math layout pipeline
- KaTeX-compatible syntax coverage
- PNG, SVG, and PDF CLI renderers
- WASM web component output
- iOS, Android, Flutter, React Native bindings
- mhchem \ce and \pu support
- CJK Unicode font fallback
- C ABI for native embedding
Use cases
- Native mobile math without WebView
- Server-side formula rasterization
- Flutter or RN scientific apps
- Offline math rendering
- Embedding WASM math in web apps