View source for MathJax Examples

{{toc numerate=1}}

Render complex math expressions using TeX or MathML syntax.

===Examples/Usage===

NOTE that the default configuration uses $ (dollar signs) to delimit TeX formulas. This may cause trouble if you have $ characters in any pages. The default configuration also lets you escape the dollar signs, however, by changing them to '\$'. This should correct any problems you might have.

%%
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
%%

%%(math)
When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
%%

Once the formatter is installed, you can write TeX formulas in your wiki with the following syntax (by default — all delimiters are configurable):

====Inline Math====
Use dollar signs: 
%%
$a^2 + b^2 = c^2$
%%

%%(math)
$a^2 + b^2 = c^2$
%%

or escaped parentheses: 
%%
\(1+2+\dots+n=\frac{n(n+1)}{2}\) 
%%

%%(math)
\(1+2+\dots+n=\frac{n(n+1)}{2}\) 
%%

====Display Math====
To display math on its own line, use double dollar signs: 
%%
$$ \frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x) $$
%%

%%(math)
$$ \frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x) $$
%%

or escaped square brackets: 
%%
\[ \sin A \cos B = \frac{1}{2}\left[ \sin(A-B)+\sin(A+B) \right] \]
%%

%%(math)
\[ \sin A \cos B = \frac{1}{2}\left[ \sin(A-B)+\sin(A+B) \right] \]
%%

A wide range of math environments will work as well: 
%%
\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*}
%%

%%(math)
\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*}
%%
Note that the math environments should not be inside the dollar sign delimiters; the environments should stand on their own with just the ##\begin## and ##\end## statements in order to be parsed correctly. 
----
====Latex====
%%
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
%%

%%(math)
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
%%

----

%%
\begin{align*} \\
M_{prod}=
\begin{bmatrix}
m_{11},\ m_{12},...,m_{1k}\\
m_{21},\ m_{22},...,m_{2k}\\
.\\.\\
m_{j1},\ m_{j2},...,m_{jk}
\end{bmatrix} \\ \\

p_{cost}=\sum_{j=1}^{n} p_jx_j \rightarrow min \quad (\text{where}\ p_j=p_j^{cap1}+p_j^{cap2}x_j)\\

z_j+\sum_{k=1}^{n}m_{jk} \cdot x_k + b_j \leq x_j + y_j \\
\sum_{k=1}^{n}m_{jk} \cdot x_k - x_j -y_j + z_j \leq -b_j \\

\sum_{j=1}^{n} \omega_j \cdot x_j \leq T(=800) \\

\sum_{j=1}^{n} c_j^{imp} y_j - \sum_{j=1}^{n} c_j^{exp}z_j \leq D(=50) \\

x_j-\sum_{k=1}^{n}m_{jk}x_k+y_j-z_j\geq b_j

\end{align*}
%%

%%(math)
\begin{align*} \\
M_{prod}=
\begin{bmatrix}
m_{11},\ m_{12},...,m_{1k}\\
m_{21},\ m_{22},...,m_{2k}\\
.\\.\\
m_{j1},\ m_{j2},...,m_{jk}
\end{bmatrix} \\ \\

p_{cost}=\sum_{j=1}^{n} p_jx_j \rightarrow min \quad (\text{where}\ p_j=p_j^{cap1}+p_j^{cap2}x_j)\\

z_j+\sum_{k=1}^{n}m_{jk} \cdot x_k + b_j \leq x_j + y_j \\
\sum_{k=1}^{n}m_{jk} \cdot x_k - x_j -y_j + z_j \leq -b_j \\

\sum_{j=1}^{n} \omega_j \cdot x_j \leq T(=800) \\

\sum_{j=1}^{n} c_j^{imp} y_j - \sum_{j=1}^{n} c_j^{exp}z_j \leq D(=50) \\

x_j-\sum_{k=1}^{n}m_{jk}x_k+y_j-z_j\geq b_j

\end{align*}
%%
----
%%
$$
e = mc^2
$$
%%

%%(math)
$$
e = mc^2
$$
%%

----
%%
$\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx$
%%

%%(math)
$\frac{1}{2\pi}\int_{-\infty}^{\infty}e^{-\frac{x^2}{2}}dx$
%%