This plugin allows you to include mathematics in a TWiki page, with a format very similar to LaTeX. The external program latex2html is used to generate gif (or png) images from the math markup, and the image is then included in the page. The first time a particular expression is rendered, you will notice a lag as latex2html is being run on the server. Once rendered, the image is saved as an attached file for the page, so subsequent viewings will not require re-renders. When you remove a math expression from a page, its image is deleted.

Note that this plugin is called MathModePlugin, not LaTeXPlugin, because the only piece of LaTeX implemented is rendering of images of mathematics.

Syntax Rules

<latex [attr="value"]* > formula </latex>

generates an image from the contained formula. In addition attribute-value pairs may be specified that are passed to the resulting img html tag. The only exeptions are the following attributes which take effect in the latex rendering pipeline:

  • size: the latex font size; possible values are tiny, scriptsize, footnotesize, small, normalsize, large, Large, LARGE, huge or Huge; defaults to %LATEXFONTSIZE%
  • color: the foreground color of the formula; defaults to %LATEXFGCOLOR%
  • bgcolor: the background color; defaults to %LATEXBGCOLOR%

The formula will be displayed using a math latex environment by default. If the formula contains a latex linebreak (\\) then a multline environment of amsmath is used instead. If the formula contains an alignment sequence (& = &) then an eqnarray environment is used.

Note that the old notation using %$formula$% and %\[formula\]% is still supported but are deprecated.

If you might want to recompute the images cached for the current page then append ?refresh=on to its url, e.g. click here to refresh the formulas in the examples below.


The following will only display correctly if this plugin is installed and configured correctly.
<latex title="this is an example">
  \int_{-\infty}^\infty e^{-\alpha x^2} dx = \sqrt{\frac{\pi}{\alpha}}

  {\cal P} & = & \{f_1, f_2, \ldots, f_m\} \\
  {\cal C} & = & \{c_1, c_2, \ldots, c_m\} \\
  {\cal N} & = & \{n_1, n_2, \ldots, n_m\}

<latex title="Calligraphics" color="orange">
  A, B, C, D, E, F, G, H, I, J, K, L, M, \\
  N, O, P, Q, R, S, T, U, V, W, X, Y, Z

  \sum_{i_1, i_2, \ldots, i_n} \pi * i + \sigma

This is new inline test.

Greek letters
\alpha \theta
\beta \iota
\gamma \kappa
\delta \lambda
\epsilon \mu
\zeta \nu
\eta \xi
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2007-02-28 - SteveGaarder
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.