0
votes

I have a cakephp site that I need to use MathJax with. I use the standard method of loading css and javascript files, but MathJax needs to load as both javascript and a text file as shown here:

The javascript is loaded as:

echo $this->Html->script('MathJax');

<script type="text/x-mathjax-config">MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], });</script>

Is there an equivalent way to load this text file?

1

1 Answers

0
votes

As per the documentation at http://docs.mathjax.org/en/latest/configuration.html there are several ways of passing a configuration to MathJax.

First, inline configuration -- what you use above.

<script type="text/x-mathjax-config">MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"]});</script>

Second, configuration files -- passed to MathJax via the url, e.g.

    <script type="text/javascript" src="path-to-MathJax/MathJax.js?config=TeX- AMS_HTML,local/local"></script>

(Take a look at the existing configuration files and watch out for the final line of each file.)

Third, starting with MathJax v2.3, in JavaScript directly e.g.

<script type="text/javascript">
  window.MathJax = {extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"]});
</script>

Keep in mind that inline configurations need to be loaded before MathJax.js is loaded.