Publishing math on the Web
I have always wanted to write something about the Riemann zeta function. But I couldn’t, not without the ability to publish in a Free and Libre Open Standard for publishing equations on the Web.
Fortunately I’ve solved it, and it was so easy. Just hook up Emacs, org-mode, spend hours reading obsolete documentation, use Docker, Gitlab CI, an obscure latex→MathML Perl library, and wrangle some Perl. Easy.
For full implementation details, see the source code of this website.
Org-mode is like Markdown, but better. It’s older, less popular and harder to compile to HTML.
MathML is an open and efficient standard by the W3C. It is in good company, along with XSLT, SVG and XHTML 2.0.
You can include MathML directly inline in the HTML, which is rendered natively by modern browsers like Chrome and also by Firefox.
(Update: couldn’t have been more wrong. Firefox displays MathML since forever, and Chrome doesn’t want to. But don’t let the truth get in the way of a bad joke.)
Because MathML is modern (it was only introduced in 1998), org-mode doesn’t support it natively yet. Luckily, there is a very popular package that you can’t install on Mac OS, called
latexml, written by a person who I definitely know, and who is definitely not susceptible to a supply chain attack.
Install latexml on Debian because that’s what you’re running in 2021:
apt-get install -y --no-install-recommends latexml
If you like Homebrew, and you want to keep liking it, don’t use it to install latexml.
To tie it into org-mode, all you need to do is spend 3 hours reading the Emacs source code because the documentation is out of date and makes no sense. Easy:
(setq org-latex-to-html-convert-command "latexmlmath '%i' | sed -e 1d | perl -p -e 'chomp if eof'")
Don’t worry about the shell injection vulnerability, be happy.
tex option to
'html in your
Now publish your project:
And find something interesting to say about the Riemann zeta function.
The Riemann zeta function
The Riemann zeta function is a mathematical equation that proves infinity:
It was independently discovered by Riemann and Zeta.
The part is widely believed to be included by Riemann to annoy his reviewers.
The Riemann-Zeta-Choice function is a British extension:
It’s exactly the same but it’s easier to type.