I'm loading MathJax from my server, so that I can concatenate it with the rest of my JS assets to improve performance. When I load the source file from my MathJax vendor directory, it works fine:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script src="http://example.com/assets-raw/vendor/MathJax/MathJax.js" ></script>
However, when I minify/concatenate MathJax.js
with the rest of my assets, the combined JS file is now found in a completely separate directory:
<script src="http://example.com/assets/js/minified.js" ></script>
Unfortunately when I do this, MathJax can no longer find config.js
, tex2jax.js
, or any of its other dependencies. The problem seems to be that MathJax has a "default directory" where it expects to find these files, and this default is a relative directory.
Looking at MathJax's documentation, they say things like
The default directory is
MathJax/extensions/
But they do not tell you how to override this default. Is this possible through MathJax's configuration?
It looks like there is an undocumented configuration setting, root
, that can be used to set the root path in the Config
options. For example:
root: 'http://example.com/assets-raw/vendor/MathJax'