erweixin/RaTeX

Public

>99.5% KaTeX syntax coverage. LaTeX math renderer in pure Rust. No JavaScript, no WebView, no DOM. One Rust core → iOS, Android, Flutter, Web, PNG. C ABI · WASM · Server-side PNG/SVG.

  • Stars1.6k+12 tuần này
  • Forks83
  • Watchers6
  • Issues10
  • Ngày tạo10/03/2026
  • Cập nhật gần nhất27/10/2026
  • Ngôn ngữRust
  • Giấy phép—
README.md31.9 KBRaw

RaTeX

简体中文 | English

KaTeX-compatible math rendering engine in pure Rust — no JavaScript, no WebView, no DOM.

One Rust core, one display list, every platform renders natively.

\frac{-b \pm \sqrt{b^2-4ac}}{2a}   →   iOS · Android · Flutter · React Native · Web · PNG · SVG · PDF

→ Live Demo — type LaTeX and compare RaTeX vs KaTeX side-by-side · → Support table — RaTeX vs KaTeX across all test formulas · → Web benchmark — head-to-head perf in the browser


Why RaTeX?

Every major cross-platform math renderer today runs LaTeX through a browser or JavaScript engine — a hidden WebView eating 50–150 MB RAM, startup latency before the first formula, no offline guarantee. KaTeX is excellent on the web, but on every other surface — iOS, Android, Flutter, server-side, embedded — you're either hosting a WebView or shelling out to headless Chrome.

RaTeX is the same KaTeX-compatible math engine compiled to a portable Rust core, so the same renderer runs natively everywhere — and produces byte-identical output across every target.

KaTeX MathJax RaTeX
Runtime JS (V8) JS (V8) Pure Rust
Surfaces it runs on Web only* Web only* iOS · Android · Flutter · RN · Web · server · SVG · PDF
Mobile WebView wrapper WebView wrapper Native
Server-side rendering headless Chrome mathjax-node Single binary, no JS runtime
Output substrate DOM (<span> tree) DOM / SVG Display list → Canvas / PNG / SVG / PDF
Memory GC / heap GC / heap Predictable, no GC
Offline Depends Depends Yes
Syntax coverage 100% ~100% Aligned with KaTeX math syntax

* Embeddable in non-web targets only by hosting a WebView or headless browser, which most native and server contexts can't tolerate.

On the web specifically, KaTeX has a decade of V8 JIT optimization behind it and remains the obvious choice for web-only projects. RaTeX's contribution isn't beating it on its home turf — it's being the only KaTeX-compatible engine that runs natively on every other surface, with pixel-identical output across all of them.

Nội dung README thuộc về erweixin và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/erweixin/RaTeX