Search code examples
fontsmathjax

Install mathjax locally, but get fonts from the CDN?


I have a mathjax installation with customized configuration (used through Sphinx) and need to store it on my server. The server's connection is not lightning-fast, so I would like to offload the largest portion of the data trasfers (math fonts) to the mathjax CDN. Is such split configuration supported or possible?


Solution

  • I don't know about Sphinx, but for a plain HTML file, you would include

    <script type="text/x-mathjax-config">
    MathJax.Hub.Register.LoadHook("[MathJax]/jax/output/HTML-CSS/config.js",function () {
      MathJax.OutputJax["HTML-CSS"].webfontDir =
         "http://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS";
    });
    </script>
    

    somewhere before the script that loads MathJax.js itself. You will have to figure out how to get that into the configuration used by Sphinx.