You are here: start » wiki » mathsyntax
Getting started
This Wiki uses the MathJax JavaScript package to display mathematics. In order to enable MathJax on a page you create in this wiki, you should add the following code to the start of the page:
{{page>book:macros:header}}
Inline mathematics
The wiki will now automatically understand most simple LaTeX commands. For example, typing
The equation of a parabola is $y=x^2$.
yields
The equation of a parabola is $y=x^2$.
Displayed math
Displayed equations are obtained as any of
\[y = x^2\] $$ax+by = c$$ \begin{equation} y=x^2 \end{equation}
which yields
\[y = x^2\] $$ax+by = c$$ \begin{equation} y=x^2 \end{equation}
You can also obtain aligned equations by typing
\begin{eqnarray} y &=& x^2 \\ ax+by &=& c \end{eqnarray}
which yields
\begin{eqnarray} y &=& x^2 \\ ax+by &=& c \end{eqnarray}
Be warned that the Wiki treats lines starting with some whitespace combinations as comments, so it is a good idea to avoid indenting multiline equations. (A single initial space or tab should not cause a problem.)
Equation Numbering
MathJax will autonumber equations in this wiki if you use LaTeX equation environments such as “equation” or “eqnarray”. For unnumbered equations, use either the “eqnarray*” environment or $$.
Cross-references are possible using \label{id} and \ref{id}, as usual.
Further documentation is available here.
Comments
In order to assist in the preparation of wiki and LaTeX documents from a single source file, this wiki understands the following modified comment syntax:
- Lines beginning with a percent sign are of course ignored by LaTeX.
- The combination percent-star is ignored by the wiki.
- A line beginning with percent-percent is ignored by the wiki.
- A line beginning space-space-percent is treated by the wiki as though the percent sign weren't there, resulting in boxed verbatim text (without the percent sign) in the wiki (and of course nothing in LaTeX).
- All text between percent-slash-star and percent-star-slash is ignored by the wiki.
Thus, the correct way to enter the call to MathJax in such a joint document would be
%*{{page>book:macros:header}}
which would be parsed correctly by the wiki (and ignored by LaTeX). Similarly, any LaTeX code which MathJax doesn't understand, such as sectioning commands, can be surrounded by a percent-slash-star/percent-star-slash pair. For example,
%/* \section{Introduction} %*/ %* == Introduction ==
would be parsed correctly by both LaTeX and the wiki (although section numbering would need to be added to the wiki by hand).
Changes to standard DokuWiki syntax
To avoid conflicts with MathJax, the standard DokuWiki carriage return syntax has been redefined so as to require four backslashes rather than two, so that
hello \\\\ goodbye
results in
hello
goodbye
Similarly, the standard DokuWiki syntax for unparsed blocks, in which such blocks are surrounded by doubled percent signs, has been changed to require four percent signs, and the standard DokuWiki syntax for monospaced text, in which such text is surrounded by doubled apostrophes, has been changed to require four apostrophes.