Rust math renderer
RaTeX is a pure‑Rust math formula renderer that targets iOS, Android, Flutter, React Native and Web without a WebView, offering near KaTeX compatibility and offline rendering. That makes it a neat cross‑platform component for apps needing local math typesetting (x.com).
Math rendering is one of those problems that looks solved until you leave the browser. On the web, KaTeX is fast and mature. In a native app, the usual answer is still awkward. Developers hide a browser engine inside a mobile screen, or ship images from a server, or accept patchy support from older platform-specific libraries. RaTeX exists because that compromise has started to feel silly. It is a KaTeX-compatible math renderer written in pure Rust, and it is built to run across iOS, Android, Flutter, React Native, the web, and even server-side PNG and SVG output without depending on a WebView, a DOM, or a JavaScript engine. (github.com) That design choice matters because math layout is not a small feature anymore. It shows up in tutoring apps, note-taking tools, science software, and AI chat products that need to display formulas locally and quickly. RaTeX’s pitch is blunt: keep parsing and layout in one Rust core, turn the result into a serializable display list, and let each platform draw that list natively. The iOS build uses Swift and CoreGraphics. Android uses JNI, Kotlin, and Canvas. Flutter talks to the engine through Dart FFI and paints with CustomPainter. React Native wraps the same core in native modules. On the web, Rust compiles to WASM and a Canvas 2D renderer draws the result. (github.com) That “display list” idea is the real story. RaTeX is not trying to recreate a browser. It is trying to separate math typesetting from the platform that eventually paints the pixels. The repository breaks that job into small crates: a lexer, a parser, a layout engine, font handling, FFI bindings, a WASM target, a PNG renderer built on tiny-skia, and an SVG exporter. That makes the project feel less like a wrapper and more like an actual rendering stack. It also explains why the same formula can move between native mobile apps, browser canvases, and server output without changing the layout logic underneath. (github.com) Compatibility is the next obvious question, and RaTeX leans hard on KaTeX as its benchmark. The project says it has about 99 percent KaTeX syntax coverage. More important, it is not asking people to trust that claim on faith. The public demo compares RaTeX and KaTeX side by side, and the support table runs across 916 test formulas. The project site says its CI uses large golden-image suites with pixel diffs against reference renders, which is a practical way to test a renderer whose job is visual correctness, not just parsing. (github.com) The project is also broader than plain schoolbook math. The README says it supports chemistry through `\ce` and `\pu`, using mhchem-style notation and unit formatting. That matters because chemistry and physics notation are exactly where many lightweight renderers fall apart. RaTeX is clearly aimed at education and scientific apps that need more than fractions and integrals. It also ships platform packages with fonts included, including an Android AAR and a Swift package, which lowers the friction from “interesting demo” to “drop this into an app.” (github.com) None of this means the project is finished. The roadmap notes that automatic equation numbering and tag placement for some multiline environments still lag behind LaTeX and KaTeX. Early issues also show the usual renderer problems, like accent placement over certain letters. But that is almost the point. RaTeX is not impressive because it is magically perfect. It is impressive because a single developer has taken one of the web’s most browser-dependent pieces of UI and rebuilt it as a native, cross-platform Rust system with public tests, live demos, and a support table that already spans 916 formulas. The latest commit landed yesterday. The repository has passed 150 stars. (github.com)