Description
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.
Examples
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}}
</latex>
<latex>
{\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>
<latex title="Calligraphics" color="orange">
\cal
A, B, C, D, E, F, G, H, I, J, K, L, M, \\
\cal
N, O, P, Q, R, S, T, U, V, W, X, Y, Z
</latex>
<latex>
\sum_{i_1, i_2, \ldots, i_n} \pi * i + \sigma
</latex>
This is

new inline test.
| Greek letters |
\alpha |
|
\theta |
|
\beta |
|
\iota |
|
\gamma |
|
\kappa |
|
\delta |
|
\lambda |
|
\epsilon |
|
\mu |
|
\zeta |
|
\nu |
|
\eta |
|
\xi |
|
Error during latex2img:
ERROR: can't find dvipng at /usr/bin/dvipng
INPUT:
\documentclass[fleqn,12pt]{article}
\usepackage{amsmath}
\usepackage[normal]{xcolor}
\setlength{\mathindent}{0cm}
\definecolor{teal}{rgb}{0,0.5,0.5}
\definecolor{navy}{rgb}{0,0,0.5}
\definecolor{aqua}{rgb}{0,1,1}
\definecolor{lime}{rgb}{0,1,0}
\definecolor{maroon}{rgb}{0.5,0,0}
\definecolor{silver}{gray}{0.75}
\usepackage{latexsym}
\begin{document}
\pagestyle{empty}
\pagecolor{white}
{
\color{black}
\begin{math}\displaystyle \eta\end{math}
}
\clearpage
{
\color{orange}
\Large
\begin{multline*}\displaystyle \cal
A, B, C, D, E, F, G, H, I, J, K, L, M, \\
\cal
N, O, P, Q, R, S, T, U, V, W, X, Y, Z\end{multline*}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \delta\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \epsilon\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \int_{-\infty}^\infty e^{-\alpha x^2} dx = \sqrt{\frac{\pi}{\alpha}}\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \mu\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \nu\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \lambda\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \xi\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \theta\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \gamma\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \beta\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \iota\end{math}
}
\clearpage
{
\color{black}
\begin{eqnarray*}\displaystyle {\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\}\end{eqnarray*}
}
\clearpage
{
\color{red}
\large
\begin{math}\displaystyle \cal A\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \zeta\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \sum_{i_1, i_2, \ldots, i_n} \pi * i + \sigma\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \kappa\end{math}
}
\clearpage
{
\color{black}
\begin{math}\displaystyle \alpha\end{math}
}
\clearpage
\end{document}
STDERR: