[Moin-user] mathjax

Eric Hui erichui at speakeasy.net
Tue Dec 14 21:10:29 EST 2010


Neal Becker wrote:
> http://www.mathjax.org/
> 
> Looks like an interesting way to integrate LaTeX markup.  Anyone looked into 
> using this?

Yes, just recently in fact.  I had been using Johannes Berg's 
latex parser on Moin 1.5.8, which is awesome.  In upgrading to 
Moin 1.9.3, decided to look at alternatives to generating pretty math.

The disadvantage of MathJax is that it doesn't support ALL markup 
that is available in the latex parser (which basically can support 
any latex/tex markup).  The advantage is that you get very nice, 
scalable rendering of the math on the client side.  I'm still 
haven't decided, but I'm thinking of migrating to MathJax.

These are the basic steps to get MathJax working w/1.9.3:

- configure your web server to serve out the MathJax scripts and fonts

- for your moin instance, edit the wikiconfig.py's html_head 
variable to add a reference to the MathJax script, something like 
'''<script type="text/javascript"> 
src="/mathjax/MathJax.js"></script>'''

- edit your moin pages to support MathJax notation

For the default configuration of MathJax, migrating from the latex 
parser and macro involved the following:

- for inline_latex, delimit the markup with \( and \) instead of $$

- for rendering a set of equations, I used to use a {{{#!latex }}} 
block.  to make it work with MathJax,  I used the html parser, 
which passes the block through unmodified.  e.g.,

{{{#!html
$$
\begin{eqnarray*}
     x_i &=& y_i^2
\end{eqnarray*}
$$
}}}

Once I get some time to do the actual migration, I'd probably 
write an actual moin parser to support MathJax, but this seems to 
do the trick.




More information about the Moin-user mailing list