Home How to type Math Expression with MathJax
Post
Cancel

How to type Math Expression with MathJax

This post is to show how to write math expression by using MathJax syntax , you can also use it as an example of writing. Now, let’s start looking at MathJax and expressions.

What is MathJax?

MathJax is a javascript display engine for rendering TEX or MathML-coded mathematics in browsers without requiring font installation or browser plug-ins. Any modern browser with javascript enabled will be MathJax-ready.

Some basic syntax

To type a math expression, surround the expression like below:

\[\text{\$expression\$}\]

The ~ acts as a space in Mathjax expression. Surround the expression by two $ will make the expression center:

\[x~y\]
1
$$x~y$$

Examples

Sum

\[\sum_{i=0}^{n^3} i^3=\frac{n(n+1)}{2}\]
1
2
3
$$
\sum_{i=0}^{n^3} i^3=\frac{n(n+1)}{2}
$$

Alpha symbol

\[\alpha^2+\beta^2=\gamma^2\]
1
2
3
$$
\alpha^2+\beta^2=\gamma^2
$$
\[\Gamma^2+\Omega^2 = \Delta^2\]
1
2
3
$$
\Gamma^2+\Omega^2 = \Delta^2
$$

Logarit

\[x_3^5 = log_3(34)\]
1
2
3
$$
x_3^5 = log_3(34)
$$

Small ()

\[\left( expression \right)\]
1
2
3
$$
\left( expression \right)
$$

Square root

\[\left(\frac{\sqrt{xyz}}{b} = \sqrt{a}\right)\]
1
2
3
$$
\left(\frac{\sqrt{xyz}}{b} = \sqrt{a}\right) 
$$

Big ()

\[\biggl( ~ \bigr) ~ \biggr)\]
1
2
3
$$
\biggl( ~ \bigr) ~ \biggr)
$$
\[\bigcup \bigcap \int_x^3 \iiiint \idotsint\]
1
2
3
$$
\bigcup \bigcap \int_x^3 \iiiint \idotsint
$$

Fraction

\[\cfrac{s}{a}\]
1
2
3
$$
\cfrac{s}{a}
$$
\[\sqrt[3]{x^3} = |x|\]
1
2
3
$$
\sqrt[3]{x^3} = |x|
$$

Limit

\[\lim_{x \to 0}{(x+4)}\]
1
2
3
$$
\lim_{x \to 0}{(x+4)}
$$

Trigonometry

\[\sin^2 \theta + \cos^2(\theta) = 1\]
1
2
3
$$
\sin^2 \theta + \cos^2(\theta) = 1
$$

Less, equal, greater

\[2 \lt 3;~ 3 \leqslant 3; ~ 3 \neq 2\]
1
2
3
$$
2 \lt 3;~ 3 \leqslant 3; ~ 3 \neq 2
$$
\[-b \pm \sqrt{b^2 - 4ac} \over 2a\]
1
2
3
$$
-b \pm \sqrt{b^2 - 4ac} \over 2a 
$$

Times

\[x \times y\]
1
2
3
$$
x \times y 
$$
\[x \to y; x \rightarrow y; x \leftarrow y; x \Leftarrow y; x \mapsto y; x \land y ; x \lor y\]
1
2
3
$$
x \to y; x \rightarrow y; x \leftarrow y; x \Leftarrow y; x \mapsto y; x \land y ; x \lor y
$$ 
\[x \star y; x \ast y; x \oplus y; x \circ y; x \approx y; x \sim y ; x \forall y; x \top y;\]
1
2
3
$$
x \star y; x \ast y; x \oplus y; x \circ y; x \approx y; x \sim y ; x \forall y; x \top y; 
$$

Infinity

\[\infty\]
1
2
3
$$
\infty
$$

Derivative

\[\partial x \over \partial y\]
1
$$\partial x \over \partial y$$ 
\[a \equiv c \pmod b\]
1
2
3
$$
a \equiv c \pmod b 
$$
\[a_1 + \ldots \cdots a_n\]
1
2
3
$$
a_1 + \ldots \cdots a_n
$$
\[cos\phi ~ cos\epsilon ~\]
1
2
3
$$
cos\phi ~ cos\epsilon ~ 
$$

\quad

Instead of using ~~~, we can use \quad.

\[a \quad b\]
1
2
3
$$
a \quad b 
$$

Pure text

\[\text{hihihi}\]
1
2
3
$$
\text{hihihi}
$$

Widehat

\[\widehat{xy}\]
1
2
3
$$
\widehat{xy}
$$

Vector

\[\overrightarrow{v} + \overrightarrow{w} = 1\]
1
2
3
$$
\overrightarrow{v} + \overrightarrow{w} = 1
$$

Differential equation

\[\dot x + \ddot x = 0\]
1
2
3
$$
\dot x + \ddot x = 0
$$
\[\{x\}\]
1
2
3
$$
\{x\}
$$
This post is licensed under CC BY 4.0 by the author.

Spiderbot

I made my own custom CAN node!