You just want equations? You don’t need TeX-the-software, just TeX-the-markup. Lots of things can render TeX math. In particular if you have an HTML or a markdown document with mathematical markup, many mathematical typesetting options are available. In fact, too many, all with incompatible syntax of course. The de facto standard is pandoc, which is what I usually use for turning my markdown+math into various documents (including, for example, parts of this blog).

## MathJax

MathJax allows you to put LaTeX equations online easily without bothering with the rest of that bullshit.

- MathJax LaTeX manual
- Carol Burns’ Exhaustive MathJax Page I find more useful, though, since it shows and tells you at the same time.
- jupyter can use MathJax out of the box.

## KaTeX

Katex is a faster competitor to MathJax, but is not yet as widely supported. Katex even eliminated another pain point, having supported macros since 0.10.rc1. You couldn’t define macros inline which was tedious because macros are ubiquitous in real mathematics work. Now you can either inject them via config, or use the esoteric low-level `\gdef`

to get LaTeX-like behaviour, since `\renewcommand`

exists but doesn’t persist between equations, which makes it pointless for anything except prototyping individual macro definitions. KaTex support of maths markup is not as complete as MathJax. In particular

- I miss the
`split`

environment. - You can’t put math markup inside
`\text{}`

## Inlined HTML mathematics

Both MathJax and KaTeX are eventually slow if you have enough equations in a document - MathJax sooner than KaTeX, but neither scales to the documents I write as a mathematician. You ideally want something different. There are a few attempts to do this.

bookish is a project by parser nerd Terrence Parr which, like my latex_fragment, translates TeX markup to SVG, but in addition works out how to align the SVG with text correctly via herculean effort.

This approach is shared with Daan Leijen’s Madoko (introductory paper), which does math rendering in PDF or HTML as embedded SVG.

Both these last 2 projects took the unusual step of not using the *de facto* standard for markdown/academia, pandoc, in favour of implementing their own new engines, which makes them a little niche.

Amazingly, despite pandoc already employing a somewhat obscure academic functional language (Haskell), Makodo chose an even obscurer academic functional language, koka. At least his one compiles to javascript, so I guess it’s not totally alien territory. Nonetheless… Anyway, it also includes some nifty publish-to-the-web features, and citation support, so maybe you don’t care about this obscurity.

There is another school of methods of rendering mathematics in HTML, which is the school who note that you can render MathJax without a browser using `node.js`

, saving some time for the reader who need not mess around with a complicated *post hoc* multi-phase javascript-based rendering procedure. Presumably this could be implemented for KaTeX too; in fact it has been; see pelican-latex-prerender. The tool *du jour* is MathJax-node-page which comes with a CLI `mjpage`

which will pre-render HTML for you—it even claims to render math as SVG too, through forbidden magic into which it is best not to enquire too closely. See also mathmd. Wikipedia aims to leverage this approach via their mathoid project.

There are some full-pipeline tools which leverage this. The one that looks shiniest is ReLaXed, which also makes the case for their take on this approach

Many of us prefer markup languages (Markdown, LaTeX, etc.) to GUI document-editors like MS Office or Google Docs. This is because markup languages make it easier to quickly write documents in a consistent style.

However, Markdown is limited to the title/sections/paragraphs structure, and LaTeX has obscure syntax and errors that also make it difficult to stray from the beaten track.

On the other hand, web technologies have never looked so good.

- Beautiful CSS frameworks make sure your documents look clean and modern.
- There are JavaScript libraries for pretty much anything: plotting, highlight code, rendering equations…
- Millions of people (and growing) know how to use these.
- Shorthand languages like Pug and SCSS are finally making it fun to write HTML and CSS.
- (Headless) web browsers can easily turn web documents into PDF, on any platform.
ReLaXed is an attempt at finding the most comfortable way to leverage this for desktop PDF creation.

However, I need citations in my workflow, and it is not immediately clear how I would inject those into such an end-to-end solution, at least not without writing yet another plugin— however, possibly Zotero could help with its HTML citation reports or maybe one of the word processor plugins supports HTML documents? It merits investigation. Not by me.

Gerby looks to be somewhere intermediate between a new markup language and HTML presentation; it generates a large indexed website from a latex document instead of a PDF.

If you have a LaTeX document which

- is large (probably several hundreds of pages at least)
- is regularly updated
- needs to be externally referenced often
you will run into the problem that

- large PDFs are not easily navigable
- PDFs of any size are not very searchable
- the internal numbering changes often, making external references outdated
Gerby addresses these problems by providing an online tag-based view, instead of just having a big PDF. Gerby is tailored towards making large online textbooks and reference works more accessible.

## MathML

Native web rendering of mathematics is provided by MathML, but it is supported, more or less, only in Firefox, and also is an ugly syntax to write by hand. It’s more of a display backend for LaTeX math, or for some kind of equation editor. Unless this is more widely taken up I won’t be investigating it for my own use. In particular, I don’t know how fast it is, which is the major pain point with the javascript-based options. There are utils to convert LaTeX math to MathML, e.g. [Texzilla]https://github.com/fred-wang/TeXZilla), or LaTeXML, which I have not tried.