Mathjax and Ikiwiki

Following the instructions http://wiki.math.cmu.edu/iki/wiki/tips/20130930-ikiwiki/010-setup.html#index1h2 repeated here

Using a plugin to load MathJAX

So far this seems to be the safest and simplest option.

Download the mathjax plugin and save it as in IkiWiki/Plugin/mathjax.pm in your libdir. You might also need to chmod -a+x the file.

Include the directive on any page that you want to use MathJAX. This will add a link to the MathJAX script from a CDN. (If your wiki's baseurl is an https URL, then this plugin will use an https CDN; if not, it will use the regular http CDN.)

If you you want to include custom macros, or customize settings (e.g. enabling inline math via \$ ... \$), then create a file called /javascript/mathjax-config.js. Put all your config/macros here as follows:

MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ['\\(', '\\)']  ]
    },
    TeX: {
        TagSide: "right",
        equationNumbers: {autoNumber: "AMS"},
        Macros: {
            // Add your macros here. Here are some examples.
            eps:        '\\varepsilon',
            cosec:      '\\operatorname{cosec}',
            abs:        [ '\\left\\lvert#1\\right\\rvert', 1 ],
            paren:      [ '#1(#2#1)', 2, '' ],
        }
    }
});

If you want to use a different config file, pass the name via the config parameter. For example, do

[[!mathjax   config="/javascript/myconfig"]]

if you save your macros in the javascript subdirectory. (If this file is not found, an error will be printed and no macro file will be used. Also this file has to be locally served; you can't use this to load external scripts.)

Note: Only one macro file per page will ever be used. Thus if you inline two pages each sourcing a different macro file, then only the last macro file sourced will be included.

That's it. If everything is setup right, typing $E=mc^2$ into some Wiki page should produce $E=mc^2$