A new release of Discourse Math

I am very happy to announce a major upgrade to our Discourse Math plugin!

Special thanks goes to @mcmcclur who helped test and build much of the new and upgraded discourse-math.

This is a very significant change – we upgraded all the way from version 2.x up to version 4.1 of MathJax, catching up with years of features and advances.

Additionally, we amended our design to make it significantly easier to upgrade the plugin in the future.

Our new iteration is much friendlier to LLM outputs, which prefer using LaTeX-style math inlines such as e=mc^2.

The plugin remains very configurable – you can use MathJax or KaTeX for math rendering and even disable the handling of \( if you wish.


Some Fun Examples to Show Off MathJax 4.1

The Quadratic Formula:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Euler’s Identity:

e^{i\pi} + 1 = 0

Maxwell’s Equations:

\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}

A Colorful Integral:

\int_{-\infty}^{\infty} {\color{red}e}^{{\color{blue}-x}^{\color{green}2}} \, {\color{orange}dx} = {\color{purple}\sqrt{\pi}}

An Infinite Series:

\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}

New in MathJax 4 – The \U{} Macro:

You can now insert Unicode characters directly into TeX input! For example:

A \U{229E} B = C

$$A \U{229E} B = C$$

This produces U+229E (⊞, a squared plus).

24 Likes

Looking at this post in a PWA on iOS, I was seeing the examples at wrong sizes/positions and being clipped as shown:

I’ve confirmed that disabling the Firefox Focus extension (content blocker) prevented this from happening. Looking closer, unsurprisingly it’s the setting for blocking web fonts.

I suspect people blocking web fonts isn’t something you want to cater for but figured I’d bring it up since it looks weirdly almost right but off in various places.

1 Like