This only works when you install the Math Behavior in the Haddock Template.
Math is JSPWiki javascript extentions which allows you to write beautiful math formulae inside JSPWiki pages. Supported formats are TeX, LaTeX and ASCIImath.

After installing the Math javascript extension, you can use the %%load-mathjax style at the beginning of your page to activate MathJax on a page. Then wrap your math equations inside certain delimiters (see blow) and they will be rendered visually.

Inline math#

To display inline TeX or LaTeX formulae, use escaped round brackets \( and \) or single dollar signs $:
Look ma, inline math \(P(E)   = {n \choose k} p^k (1-p)^{ n-k}\) \\
The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
Look ma, inline math \(P(E) = {n \choose k} p^k (1-p)^{ n-k}\)
The quadratic formula is $-b \pm \sqrt{b^2 - 4ac} \over 2a$
LaTeX cheat sheet

Display math (presented centered on a new line)#

For larger equations separated from the rest of the text, use double dollar signs $$: also use escaped square brackets \[ but don't forget to escape the opening square bracket
Like this $$P(E) = {n \choose k} p^k (1-p)^{ n-k}$$ 
Like this $$P(E) = {n \choose k} p^k (1-p)^{ n-k}$$

Markup blocks (separated by some blank lines)#

Use markup blocks which stand on their own with just the \begin and \end statements in order to be parsed correctly.
\begin{align*}
e^x & = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \cdots ~\\
    & = \sum_{n\geq 0} \frac{x^n}{n!}
\end{align*}
\begin{align*} e^x & = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \cdots \\ & = \sum_{n\geq 0} \frac{x^n}{n!} \end{align*}

ASCIImath #

Use backticks ` for math written in ASCIImath format.
  • The quadratic equation x = (-b +- sqrt(b^2-4ac))/(2a) yields to `x = (-b +- sqrt(b^2-4ac))/(2a)`
  • Matrices: [[a,b],[c,d]] yields to `[[a,b],[c,d]]`
  • Column vectors: ((a,b),(c,d)) yields to `((a,b),(c,d))`
  • Complex subscripts: lim_(x->oo) yields to `lim_(x->oo)`
  • Subscripts must come before superscripts: int_0^1 f(x)dx yields to `int_0^1 f(x)dx`

Notes:#

  • The markup of JSPWiki may interfere with the math TeX or ASCIImath language.
    • Use the tilde ˜ to escape wiki markup. (eg ˜\\ to escape the newline markup, ... ).
    • Use the double square bracket [[ to escape the start of a link.
  • The MathJax libraries are dynamically loaded after loading the JSPWiki page. This may lead to a slight delay when rendering the math formulae.
  • If you want the math to stand out from the other page content, you can decide to add additional css styles on the rendered formulae like this:
%%add-css
    /* Display math*/
    .MathJax_SVG_Display { background: gold; }
    /* Inline math*/
    .MathJax_SVG { background: DarkKhaki;}
/%

More Examples#

$$ X(m,n)= \begin{cases} x(n),\\ x(n-1)\\ x(n-1) \end{cases} $$


$$ f(n) = \begin{cases} n/2 &\mbox{if } n \equiv 0 \\ (3n +1)/2 & \mbox{if } n \equiv 1 \end{cases} \pmod{2}. $$


$$ f^{(n)}(a) = \frac{n!}{2\pi i} \oint_\gamma \frac{f(z)}{(z-a)^{n+1}}\, dz. $$