Static rendering of LaTeX to MathML #9

Open jonmsterling.com
Open opened by jonmsterling.com

This would be an alternative to KaTeX; see https://ctan.org/pkg/luamml?lang=en, which can convert LaTeX math to MathML. I am envisioning a pipeline that is kind of similar to how we generate SVGs for diagrams, but where instead we are calling luatex to produce MathML snippets. It seems viable, assuming a good caching regime.

I am interested in this because it would make it so that I can include mathematics in my Atom feed. Depending on browser support, users may or may not wish to use this for the actual online view, but some may prefer it.

I added Latin Modern math to the fonts shipped in the theme. Unlike the fonts that KaTeX uses, it is a font that ships an OpenType math table, so the mathml output looks quite nice: Image

By the way, that font does indeed look nice. It is seeming to. me like 2026-2027 is going to be the year of being able to use MathML directly in modern web browsers.

I was thinking about this and I think basically the main obstacle is that in the current architecture, we don't really have a way to run an external transduction task at evaluation-time — and I think that might be a good thing, since it is nice if evaluation is pure. The reason LaTeX-to-SVG is fine is that we content-address the artefact; with MathML, and other possible transduction tasks that we might consider (e.g. as a lightweight plugin system!), the result is supposed to be inlined into the output rather than addressed.

One possible approach would be to still content-address it and store the address in the IR, and look it up in the in-memory database during rendering. Curious what you think.

FYI, I am doing a larger writeup of my thoughts on this

I am thinking that the thing I am writing could serve as the foundation for our next grant proposal

Ooo. That sounds great 😃

Sign up or Sign in to add to the discussion.