MathJax

  • Post author:
  • Post category:Maths

Pretty Maths Stuff

MathJax lets you add maths \( (a \ne 0) \) formulae like \( a_\kappa \ne 0 \) to your posts using the well established \( \LaTeX \) language.

$$
x =\sin \alpha
= \cos \beta
$$

$$
\begin{equation}
E = mc^2
\end{equation}
$$

Inline use

Equations can be placed inline with text for better flowlike this: \( e^{i\pi} + 1 = 0 \). This style works well where the equation is relatively simple \(a \lt b \). More complex equations like this one, \( f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi \), or this one \( \begin{vmatrix}a&b\\c& d\end{vmatrix}=ad-bc \) may not work so well because the height has to be adjusted to accomodate the rendered equation and things can get a bit cramped. If this looks OK to you then it is fine. there is also the question of where the line wraps and an equation cannot fit into the \( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \) available space.

This looks much better:
$$f(x) = \int_{-\infty}^\infty \hat{f}(\xi)\,e^{2 \pi i \xi x}\,d\xi$$

Separate Lines

It is often more convenient to have equations, or a series of equations, displayed in their own space on the page. You can do that with an inline style but in its own paragraph.

\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)

\(q=\frac{1+y}{1+2z^2}\)

Here though, the equation will be left justified in the space and may also be too small.

Often, it will be better to use the block display style and have each equation properly centered in the space. Place each equation in its own block or they will be joined together

$$
x = {-b \pm \sqrt{b^2-4ac} \over 2a}
$$
$$
x=\frac{1+y}{1+2z^2}
$$

examples

$$\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}$$
$$ x_1 = a+b ~~{and}~~ x_2=a-b $$
$$
x=\frac{1+y}{1+2z^2}
$$

$$
x = {-b \pm \sqrt{b^2-4ac} \over 2a}
$$
$$
x=\frac{1+y}{1+2z^2}
$$

Equation array

$$
\begin{equation}
\begin{array}{l}
\displaystyle \int 1 = x + C \\
\displaystyle \int x = \frac{x^2}{2} + C \\
\displaystyle \int x^2 = \frac{x^3}{3} + C
\end{array}
\label{eq:xdef}
\end{equation}
$$


The code for the equation array above is:

$
\begin{equation}
\begin{array}{l}
\displaystyle \int 1 = x + C \\\\
\displaystyle \int x = \frac{x^2}{2} + C \\\\
\displaystyle \int x^2 = \frac{x^3}{3} + C
\end{array}
\label{eq:xdef}
\end{equation}
$

$$
\begin{equation}
\begin{array}{l}
\displaystyle \int 1 = x + C \\
\displaystyle \int x = \frac{x^2}{2} + C \\
\displaystyle \int x^2 = \frac{x^3}{3} + C
\end{array}
\label{eq:xdeq}
\end{equation}
$$

Equations can be tagged (numbered)

$$\tag{21} x+y^{2x}$$

$$\tag{22} x+y^{2x}$$

In equation \(\eqref{eq:sample}\), we find the value of an
interesting integral:
$$
\begin{equation}
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
\label{eq:sample}
\end{equation}
$$

$$ \begin{vmatrix}
a&b\\
c&d
\end{vmatrix}=ad-bc
$$

$$
\begin{equation}
\begin{split} \label{x5}
x &= a + b \\
&= c + d + e.
\end{split}
\end{equation}
$$

$$
\begin{array}{cc}
a & b \\
c & c
\end{array}
$$

$$
\begin{gather}
x = a + b, \label{x2} \\
y = c + d + e + f. \label{y2}
\end{gather}
$$


Further Information

I managed to get MathJax working on this site after reading Using MathJax and Markdown in WordPress

The MathJax documentation should tell you pretty well everything you need to know:

More Inspiration

These sites will give you some examples. The opening and closing tags may differ slightly from those supported on these pages. Remember that MathJax only renders stuff from the math sections.