5  MathJax

MathJax is the javascript library that turns your LaTeX code into pretty html. It knows AMS math but it doesn’t turn on numbering by default (weirdly). You need to set some config to do that. The way you set configuration is totally different for MathJax 2+ and MathJax 3+. MathJax 2.7 is ancient but it’s all over the place where developers have hard-coded in a MathJax library. The mathjax.hmtl file below will set the config for both MathJax 2.7 and MathJax 3+ numbering. It doesn’t seem to break things to set both so might be more robust to set configs for both versions.

Always check what MathJax version is being used if you are having html issues. Look at the page source and search for mathjax.

Put this in your mathjax.html file that you include in your _quarto.yaml file.

<!-- This is what works with MathJax 2.7 (which is ancient but all over the place) -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  TeX: { equationNumbers: {autoNumber: "AMS"} },
  tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"] ]}
});
</script>

<!-- This is what works with Quarto and MathJax 3+ -->
<script>
  MathJax = {
    tex: {
      tags: 'ams'  // should be 'ams', 'none', or 'all'
    }
  };
</script>