[McGranaghan]: Isn’t the state of the art [for rendering equations in the browser] generating PNG and sticking it in the web page?
[Slim]: Not exactly but almost.
So MathML, which is an XML dialect or mathematical markup language was this effort to build XML style syntax for typesetting mathematics naturally. It is only implemented in Firefox, so that's really unfortunate.
So in terms of the state of the art, there are basically two libraries that you can use to typeset mathematics: there's MathJax and KaTex.
MathJax supports all valid LaTex […]. The problem is that MathJax is very slow. So if you ever go on MathOverflow or another related StackExchange and you see all of these answers with weird gaps, and then as you watch before you the page starting to load all of the rendered equations bumping everything down one level at a time, that's MathJax in action. And oftentimes it is doing what you're describing where it is outputting an SVG or a PNG or something like that. And it's reflowing the page with every equation.
Then you have KaTex, which was a library developed at Khan Academy where they realize that MathJax’s performance was not satisfactory for their exercises. KaTex supports a much more limited subset of all of LaTex syntax, but it does it all using CSS and it doesn't reflow the page for every equation, it’s basically instant rendering.
And basically, it means that your options if you want to render math are:
- Only target Firefox
- Use a limited subset of math that’s supported by KaTex
- Constrain yourself to extremely slow, dozens-of-reflow, full-expressive-power rendering to inline PNGs.
And that's just not a great situation to be in and we haven't even gotten to the question of how people write math. So I would say that people underestimate how open this problem space is. Just take a moment of silence to like recognize the gravity of the situation.
Slim Lim, Metamuse Episode 48 Rich Text with Slim Lim, 52:05, https://open.spotify.com/episode/51u2e3Ak6E4yMfqmA0NOdm?si=kKrmc0JWRdey8N1s1OXC9A
[Slim] And that goes back to something that Adam and I were chatting about earlier, which is that a lot of people gripe and complain, that LaTex is the best we have, and, you know, I'm one of them. But it really is the case that LaTex was this monumental effort by really a few people, and amount of effort that would be considered really impressive if I were to try to do the same thing but better today. Not a lot of people have spare time to do this all-in-one text formatting and packaging document representation project even though it would have a huge impact on the way people write and publish these kinds of documents.
And so, in many ways, we're sort of just bottlenecked on the fact that it's hard to do incremental improvements to this particular area. We really depend on these software monoliths to keep us afloat.
[…]
[Wiggins] And yeah, I agree. It's a monumental effort, but I mean mathematics is so important and foundational and so much of human endeavor that certainly seems like one worth investing in, although perhaps hard to reap a profit from and that makes it harder to put concentrated capital behind it.
Slim Lim & Wiggins, Metamuse Episode 48 Rich Text with Slim Lim, 48:30, https://open.spotify.com/episode/51u2e3Ak6E4yMfqmA0NOdm?si=BHebRCxjQVSETJlrxi1McQ