Skip to content

Integrating mathjax into x: require.js

Peter Krautzberger edited this page Aug 18, 2013 · 1 revision

After loading require.js you can do

require(["http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"]);

to get MathJax to run. Again, you could add a local configuration file as above.

To load a custom configuration you can add it to the require config by doing something like:

require.config({
  paths: {
    /* Note the `delayStartupUntil=configured` parameter */
    mathjax: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML&delayStartupUntil=configured"
  },

  shim: {
    mathjax: {
      exports: "MathJax",
      init: function () {
        MathJax.Hub.Config({ /* Your configuration here */ });
        MathJax.Hub.Startup.onload();
        return MathJax;
      }
    }
  }
});
Clone this wiki locally