Remix.run Logo
RaTeX: KaTeX-compatible LaTeX rendering engine in pure Rust(ratex.lites.dev)
80 points by atilimcetin 3 days ago | 35 comments
Hendrikto an hour ago | parent | next [-]

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.

ngriffiths an hour ago | parent | next [-]

It's kinda fascinating how dominant LaTeX is, how nice its output is, how respected Knuth is as a computer scientist, and at the same time how totally awful it feels to use it. Hard to figure out how it can be so good and so bad at once.

Posts/discussion I found interesting:

- http://www.goodmath.org/blog/2008/01/10/the-genius-of-donald...

- https://tex.stackexchange.com/q/24671

- https://news.ycombinator.com/item?id=15733381

In particular it's interesting how people seem to think TeX itself is actually quite nice to use but its popularity and LaTeX packages created a huge mess of a system.

forlorn_mammoth an hour ago | parent [-]

part of the challenge is the inherent irreducible complexity of the domain. "Make text look good on page" leaves lots of details unspecified.

another part is many people built their own solution to their own corner of this domain, and not all of them had the deep appreciation for how the rest of the TeX system works.

I hear similar complaints about "Make web page look good", which is popular but also a huge mess of a system.

huijzer an hour ago | parent | prev | next [-]

I’ve been using Typst for years now. Wrote my PhD thesis in it [1] as well as a book. Works great; can’t recommend it enough. I usually barely use plugins because it’s either already included or pretty easy to write a bit of code yourself

[1]: https://github.com/rikhuijzer/phd-thesis

quantummagic 19 minutes ago | parent | next [-]

Didn't see a pdf of your thesis, except on your web-site[1]. But the version there (at least as it renders on my machine), has numerous formatting issues. For one egregious example, look at the letter spacing in the title and legend of Figure 2.2 (page 27): "civilia ns", "Pe rs ona lity s core". I'm sure the content is great, but using it as an example of Typst prowess, seems ill-advised.

[1] https://huijzer.xyz/files/f72fa09561f20162.pdf

auggierose 23 minutes ago | parent | prev [-]

How about adding a PDF release ;-)

noelwelsh an hour ago | parent | prev | next [-]

This mirrors my experience.

It's worth noting that TeX was developed in the same time period that the details of lexical scope were being nailed down by Guy Steele in the Rabbit compiler for Scheme. It's not that TeX is an ad hoc system; it's more the case that people didn't actually know how to implement a better system at the time.

groos an hour ago | parent [-]

'People' in this case were Don Knuth (TeX) and Leslie Lamport (LaTeX). Both are Turing Award winners.

tialaramex 24 minutes ago | parent [-]

That's true. Do you know who else won a Turing Award? Tony Hoare.

What is Tony famous for? Well, lots of things, including his very important comparison sort algorithm Quicksort, but, in this context how about the Billion Dollar Mistake ? That's a pretty nasty booboo in many programming languages for which Tony blames himself because it was his idea.

Like your parent said, TeX shipped a long time ago and we learned a lot since then, it is not a surprise that we know how to do better today, in fact it would be a serious black mark for Computer Science if we couldn't.

bee_rider an hour ago | parent | prev | next [-]

I like LaTeX for the most part (I have had to use some weird hacks but usually once they are done they are stuck in a macro and turned ignorable).

But I think the main things it has going for it are that it: produces nice output, and all the journals accept it. Does there exist a tool that renders Typist to LaTeX? That could play nicely with the existing ecosystem.

abdullahkhalids 34 minutes ago | parent | prev | next [-]

Latex is used because writing math in latex is very good, and despite how everything else (like tables and figures) is so bad.

That's why people take the math subset of latex and use it in other contexts - exactly like this product.

troyvit an hour ago | parent | prev | next [-]

Huh. My special lady friend is in the process of finishing up her thesis using LaTeX after ditching LibreOffice. It was nightmare for some of the same reasons: bad UX, bad portability and crippling bugs. There was a ramping up period, and she had an out of date GitHub repo to help her, but she is incredibly happy that she switched. Collaboration could be smoother I guess.

wmkn 38 minutes ago | parent | prev | next [-]

Yups, I love the idea of LaTeX, LaTeX itself not so much.

xienze 37 minutes ago | parent | prev | next [-]

> The only drawback I can see is the ecosystem being smaller and less mature.

This seems like the _perfect_ use for and LLM: systematically porting over as much of the "ecosystem" to Typst as possible. Is anyone doing that?

luz666 29 minutes ago | parent [-]

Two hours ago a coworker told me that he let an llm port his latex template to typst. According to him, it was perfect.

LoganDark an hour ago | parent | prev | next [-]

I hope Typst eventually gets some equivalent to tkz-euclide, as I've never seen anything even remotely comparable.

esafak an hour ago | parent | prev | next [-]

Is Typst appropriate for web apps; e.g., the input forms here?

noelwelsh an hour ago | parent [-]

Nope. Typst's primary output is PDF, and it is a stand-alone binary. It's a replacement for most uses of LaTeX to produce documents. It is not a replacement for this project, which focuses only on rendering LaTeX math code and can be embedded in multiple different runtimes.

krater23 an hour ago | parent | prev | next [-]

I know exactly what you mean, and that paired with a community that is absolutely sure that they know exactly how things need to be done and everyone that wants it in another way is dumb.

magnio an hour ago | parent | prev [-]

You want Typst: https://github.com/typst/typst

It's like the JSX of Latex: markup in a programming language, not a programming language pretends to be markup.

DoctorOW an hour ago | parent [-]

> 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.

azverev 2 hours ago | parent | prev | next [-]

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?

tabbott 2 hours ago | parent | prev | next [-]

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).

DominikPeters 2 hours ago | parent | prev | next [-]

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.)

rafram 34 minutes ago | parent | next [-]

If RaTeX gets to brag about having a 0 KB JS bundle, the other libraries should be able to say they have 0 KB WASM bundles!

nicoburns an hour ago | parent | prev [-]

Where this clearly wins is native rendering use cases where there is no browser or JS engine involved at all.

umvi 2 hours ago | parent | prev | next [-]

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+

Rochus 3 days ago | parent | prev | next [-]

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

ocimbote an hour ago | parent | next [-]

I've discovered typst in the last year and used to build a resume and cover letter template that feeds from a YAML file.

After a bit of tinkering and understanding the idiosyncracies of Typst, the joy of having reliable, consistent, beautiful, data-driven resumes and cover letters is not measurable. It basically lifted any barrier to applications, while whatever I had before I had always considered a burden.

On top of that, I can add hiring process data directly to the yaml file to run further analysis.

Can LaTeX do this? Most probably, but the learning curve is the difference.

evilmonkey19 2 hours ago | parent | prev | next [-]

I have been using Typst for creating notes and it is an awesome tool. I use it to create notes on welding for my students. It makes my life so much easier compared to badsoft and its not-word-ing (you understand me).

jason_s 2 hours ago | parent | prev [-]

I greatly prefer Typst's clean architecture than TeX's macro-centric hell pounded into passable utility.

mrichman 28 minutes ago | parent | prev | next [-]

I switched to Typst a year ago and never looked back

marvinified 43 minutes ago | parent | prev | next [-]

Interesting! Would love to see how RaTeX evolves.

Piterniel an hour ago | parent | prev | next [-]

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

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

colechristensen an hour ago | parent | prev [-]

Anybody embed it in a markdown renderer yet?