Top
Best
New

Posted by suioir 10/29/2025

KaTeX – The fastest math typesetting library for the web(katex.org)
181 points | 74 commentspage 2
atkirtland 11/5/2025|
KaTeX has always seemed pretty inferior to me compared with MathJax. The most significant flaw is that it is very unstable, frequently failing at rendering rendering large documents with many equations. This happens across several applications, though I suppose it could be machine-specific. It also doesn't support several basic packages that MathJax supports. Without measuring the speed difference, I've never noticed a gap anyways.
suioir 10/29/2025||
A commenter left this on another HN post [0] and I thought it was worth its own.

[0] https://news.ycombinator.com/item?id=45701400

joppy 11/3/2025|
The commenter says pre-rendered/server-side-rendered mathematics (via katex) is great - I’ve found the opposite. It’s probably great if you have an article with one or two equations. On the other hand, if you have an article which uses mathematics pervasively, like many pure mathematics articles, it quickly becomes far more space efficient to render the mathematics on the client side. You can quickly get 200kB+ pages by pre-rendering.
Galanwe 11/3/2025|||
My experience with dynamically rendered math has been the opposite: if you have lots of equations to render, it inevitably takes some milliseconds to render, which makes the whole content move around and shake as rendering takes places.
ayhanfuat 11/3/2025|||
Indeed. It was hell to navigate pages that rendered MathJax on demand. That also improved a lot though.
blenderob 11/3/2025||||
> it inevitably takes some milliseconds to render, which makes the whole content move around and shake as rendering takes places.

What a boldly incorrect comment! It's like you didn't even read the first point in TFA!

Latitude7973 11/3/2025||||
Did you read the article? That's what the KaTeX project specifically claims to address.
cubefox 11/3/2025||
The previous comment was about using KaTeX for pre-rendered equations.
Vosporos 11/3/2025|||
It's not too late to delete this comment.
lifthrasiir 11/3/2025||||
KaTeX weighs about the same if you do care about those metrics, however.
susam 11/3/2025||
In case anyone wants to look at actual numbers about how much KaTeX weighs for a simple mathematics page: https://news.ycombinator.com/item?id=44614133

Quoting the relevant part from that link:

  katex.min.css              23.6 kB
  katex.min.js              277.0 kB
  auto-render.min.js          3.7 kB
  KaTeX_Main-Regular.woff2   26.5 kB
  KaTeX_Main-Italic.woff2    16.7 kB
  ----------------------------------
  Total Additional          347.5 kB
Of course, if the page uses more symbols in various sizes, then a few more fonts files (.woff2) need to be pulled in which case the weight of KaTeX would increase a bit too. Each font file weighs between 4 kB and 28 kB.
eviks 11/4/2025||||
But how is better space efficiency at this level better than worse rendering efficiency?
djoldman 11/3/2025||||
Could you please provide an example?
adastra22 11/3/2025|||
Is 200kB supposed to be a lot?
inasio 11/3/2025||
A few years ago I was evaluating options to move away from a deprecated external latex library my company relied on in Confluence, and tested Notion. I was super impressed at the rendering speed of their latex implementation (KaTex of course). As other have mentioned, not everything is there, but it was sufficiently good for our purposes. The switch was a pain, I hoped that Notion had good tools to move over from Confluence, but we had to do a custom job relying on sketchy undocumented APIs
viktorstrate 11/5/2025||
What benefits does KaTeX provide over MathML which is natively supported by all major browsers, I suppose it can’t be faster than that?

https://developer.mozilla.org/en-US/docs/Web/MathML

jerrygoyal 11/4/2025||
We used KaTeX via a React plugin to render math formulas as part of the AI response for our AI Writing Chrome extension (Jetwriter AI). We faced many challenges, especially with how different AI models syntax formulas, and had to do some string manipulation to make it work. Sadly, there isn't a go-to KaTeX library that would just work for AI chat apps.
bobajeff 11/3/2025||
I use this all the time when editing markdown in vscodium. It's fast enough for the side preview and supports all the LaTeX commands I need so far. When I need a PDF Pandoc handles the conversion well enough for me. I've tried using Quarto's preview but it's so slow in comparison.
larodi 11/3/2025||
Powering the math inference revolution given is used by every other LLM provider such as ………(name it).
thomasahle 11/3/2025||
Some earlier discussions (2022): https://news.ycombinator.com/item?id=31441979

Most critique of KaTeX over MathJax is reduced support for LaTeX features.

More comments...