logoalt Hacker News

RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust

81 pointsby atilimcetinlast Monday at 4:19 PM40 commentsview on HN

Comments

Hendriktotoday at 1:51 PM

I used LaTeX for approximately 10 years, for little things to relatively complex, including my bachelor’s and master’s theses. It never felt natural at reliable or consistent. Every customization required weird \makeatletter \makeatother hacks and was very brittle. Everything seemed more complicated than necessary and hard to grok, with weird interdependencies and interactions.

There are probably good reasons for all of that, but it is just both bad DX and bad UX. It feels like you need to be a hardcore LaTeX expert or consult with one, in order to accomplish the most mundane things. Especially in a reliable way, that won’t break upon making seemingly unrelated changes, or won’t break other things itself.

I used Typst for a few weeks. It already feels much more understandable, consistent, hackable, and customizable. I guess that is the difference between an ad hoc macro system and an actually thought through programming language.

The only drawback I can see is the ecosystem being smaller and less mature. That is, however, counteracted by being able to do things on your own, without immersing yourself deeply in LaTeX for years. Also, it will improve with time.

LaTeX is great, don’t get me wrong. But its heritage and historical baggage is really dragging it down.

show 15 replies
azverevtoday at 1:45 PM

Pixel-diff CI against a golden suite is the right discipline for layout libraries, and it's noticeably rare in the JS ecosystem.

Most "matches KaTeX" claims I've seen in the wild rely on screenshot eyeballing, which collapses on edge cases like spacing primes, integral subscripts, and matrix delimiters that scale.

One thing I'd be curious about: how are font fallbacks handled when the same Rust core ships to platforms with different system font availability?

KaTeX bundles fonts and assumes they load cleanly; CoreGraphics and Skia bring their own glyph caches and metrics.

Does the display list carry metric snapshots from the host text shaper, or does the core compute layout from a bundled metric file independent of the backend?

tabbotttoday at 1:24 PM

It's interesting to me that the page doesn't describe the size of the rust binary (relevant for mobile app use cases where you would need to add the Rust binary to your app) or performance.

The webpage also does read like it was at least heavily LLM assisted, which makes it a bit hard to trust it.

That all said, this is definitely something I'd be interested in using for Zulip if is indeed going to be a well maintained open source project.

(We currently have a node server component that the Zulip server runs only the render LaTeX).

DominikPeterstoday at 1:05 PM

The landing page (clearly to a large part written by LLM) does not mention that both KaTeX and mathjax can render to SVG in node. This wasm approach might still be lighter, but the advantage is not as clear as the page makes it seem. (It also contains LLM dishonesties like that the bundle size is 0 KB.)

show 3 replies
umvitoday at 1:27 PM

We recently switched from Node.js + Mathjax for rendering latex to Goja (https://github.com/dop251/goja) + Mathjax, and surprisingly it worked really well. We did this because the app is already 99% golang, and this allows us to eliminate the remaining non-go pieces, greatly simplifying the SBOM. And yes, we tried go-latex, but it's not nearly as feature complete as Mathjax. Not to mention using goja + Mathjax adds 10MB to binary size while Node.js adds 200MB+

Rochuslast Monday at 10:25 PM

Interesting. Reminds me of Typst (both implemented in Rust and replacing TeX to some degree) and Microtex.

ceayotoday at 3:21 PM

I'm sorry but the only thing that truly understands TeX, is, and will forever be, TeX.

mrichmantoday at 2:50 PM

I switched to Typst a year ago and never looked back

marvinifiedtoday at 2:35 PM

Interesting! Would love to see how RaTeX evolves.

Piternieltoday at 2:00 PM

> JS bundle (typical) 0 kB JS (core is WASM)

I guess you should mention how much is WASM, right?

colechristensentoday at 1:51 PM

Anybody embed it in a markdown renderer yet?

huflungdungtoday at 2:11 PM

[dead]