Follow these steps to add the support for Math to your JSPWiki site. In order to do this, you will need Admin rights; and have the Haddock Template activated.

See MathJax for more detailed documentation.
Note that we link directly to the MathJax distributed network service(//cdn.mathjax.org) so you not need to install anything locally.

Step 1#

Create a javascript behavior file MathJax.js and put it in the <your-wiki-site>/scripts folder.

/*
Behavior: MathJax
   
Example
>   $$ x=−b±b2−4ac2a $$
*/
Wiki.once(".load-mathjax", function(elements){

    window.MathJax = {
        tex2jax: {
            inlineMath:  [ ['$','$'], ['\\(','\\)'] ],
            displayMath: [ ['$$','$$'] ]
        },
        asciimath2jax: {
            delimiters: [['`','`']]
        }
    };

    "script".slick({
        type: "text/javascript",
        src: "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_SVG,Safe"
    }).inject(document.head);

});

Step 2#

Add following lines to the <your-wiki-site>/templates/haddock/commonheader.jsp file.

  <!-- existing line -->
  <script async src="<wiki:Link format='url' jsp='scripts/haddock.js'/>"></script>
  <!-- add this line -->
  <script src="<wiki:Link format='url' jsp='scripts/MathJax.js'/>" ></script>
And do the same in the <your-wiki-site>/templates/reader/ViewTemplate.jsp.

Step 3#

You are now ready to render Math formulae on your wiki-pages !
No need to restart your JSPWiki server.