Hugo is a popular and fast engine to build static sites from Markdown content files. But if you want to render LaTeX math equation in your html pages, you need more. Mathjax and Katex are two options to do the job.

Mathjax is a powerful Javascript engine which renders each LaTeX snippet into a svg, while Katex is a lightweight math typesetting library which renders each LaTeX symbol into kind of typesetting character. As a result, Katex is much faster than Mathjax.

However, Mathjax can render most LaTeX expressions and automatically number equations, while Katex sometimes do not work. For example, Mathjax can render aligned equations and LaTeX snippet like “$\text{$$…$$}$” while Katex can't. Both engine can render equations between “\text{$$$$…$$$$}". In practice, Mathjax rendering is pretty fast.

Following websites show the comparison of the two engines:

I found blog “Setting MathJax with Hugo” useful to help intergrate your own hugo theme with Mathjax, and to config hugo with Katex, try “KaTex Intergration” and “KaTex document".