This is a reasonably complete sample of using MathJax.

Sample has been taken form here:
https://groups.drupal.org/node/1263

MathJax documentation is here:
http://docs.mathjax.org/en/latest/

Wonder how much of this works:
https://yutsumura.com/mathjax-in-wordpress/

Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. \(x^2\).

Examples for paragraph math are \(x^2 \) and \(x^2\) (both variants are equivalent).

There is also a display-style inline math environment, compare \(\sum_{k=1}^\infty \frac{1}{k}\) and \(!\sum_{k=1}^\infty \frac{1}{k}\).

To make a dollar sign, you have to type \$ as in LaTeX!
Using just $ doesn’t work.
Latex: \(\$ \)
and
Latex: \($ \)

Arbitrary LaTeX code can be rendered as in this example:
Let $x^2$ be a natural number. 

There are also more elaborate environments to write math – they support auto-numbering, referencing and more. These environments are <equation> and <equations>. They both support the same attributes.

E.g. rendering an equation with a different resolution:
<equation>e^{i \cdot \pi} = -1<equation>.

To give the equation automatically a number, you have to give it an id:
e^{i \cdot \pi} = -1.

You now can produce a link to that equation by typing \\ref{euler}, or even better (\\ref{euler}).

You can also give it a name instead of a number:
e^{i \cdot \pi} = -1.

An example for the <equations> environment is given by:
\(
\int \ln(x) \;dx
&= \int 1 \cdot \ln(x) \;dx \
&= x \cdot \ln(x) – \int x \cdot \frac{1}{x} \;dx \
&= x \cdot \ln(x) – x
\)

The spaces on the left are optional.

To prohibit some text from being processed by DruTeX, you can use <code> and <notex>:
e.g. $x^2$
or
$x^2$
Humm… doesn\’t work!

\(\left(\int_{-\infty}^\infty e^{-x^2}\ dx\right)^2\ =\ \pi (\ref{test}) \)

Extra bit

\(e^{ \pm i\theta } = \cos \theta \pm i\sin \theta\)


Posted

in

by

Tags: