Search code examples
python-sphinxmathjax

MathJax extension mhchem in Sphinx


How do you enable MathJax extension mhchem in Sphinx? MathJax is loaded from CDN.


Solution

  • Add the following block into your rst file. Or see Adding a javascript script tag some place so that it works for every file in sphinx documentation to add it into your template, so it can be applied globally.

    .. raw:: html
    
        <script type="text/javascript" >
        MathJax.Hub.Config({
            TeX: { extensions: ["mhchem.js"] }
        });
        </script>