MathJax
Introduction
MathJax is a powerful tool to display mathematic notation and formulas on web pages.
How to use MathJax
Guide for hosting your own copy of mathjax can be viewed here.
For inline formulas, enclose the mathematical expression in \\(...\\)
, while for block display, enclose the mathematical expression in $$...$$
.
Secial symbols and notations
\lt
\(\lt\) \gt
\(\gt\) \le
\(\le\) \ge
\(\ge\) \ne
\(\ne\)
\forall
\(\forall\) \exists
\(\exists\) \in
\(\in\) \notin
\(\notin\)
\alpha
\(\alpha\) \beta
\(\beta\) \Delta
\(\Delta\) \Omega
\(\Omega\)
Supercript ^
subscript _
for example, x_i^2
\(x_i^2\) \log_2 x
\(\log_2 x\)
$$
\lim_{h \to 0} \frac{f(x + h) - f(x)}{h}
$$
Use curly braces {}
to group elements, for example 10^{10}
\(10^{10}\)
Calculus
$$ f' = \frac{df}{dx} \bigg|_ {x=a} $$
Ppiecewise functions
We use the construct {cases}
. End each case we use &
before parts that should be aligned. For example:
\bar x =
\begin{cases}
2^n - x, & \text{if} \quad x \ne 0 \\
0, & \text{otherwise}
\tag{1}
\end{cases}
$$ \bar x = \begin{cases} 2^n - x, & \text{if} \quad x \ne 0 \\ 0, & \text{otherwise} \tag{1} \end{cases} $$
We can move the brace to the right:
\left.
\begin{array}{l}
\text{if \\(n\\) is even:} & n/2 \\
\text{if \\(n\\) is odd:} & 3n+1
\end{array}
\right\}
=f(n)
$$ \left. \begin{array}{l} \text{if \(n\) is even:} & n/2 \\ \text{if \(n\) is odd:} & 3n+1 \end{array} \right\} =f(n) $$
We can set larger line height between cases by using \\[2ex]
instead of \\
:
f(n) =
\begin{cases}
\frac{n}{2}, & \text{if \\(n\\) is even} \\[2ex]
3n+1, & \text{if \\(n\\) is odd}
\end{cases}
$$ f(n) = \begin{cases} \frac{n}{2}, & \text{if \(n\) is even} \\[2ex] 3n+1, & \text{if \(n\) is odd} \end{cases} $$
Chemical formulas
$$ \require{mhchem} \ce{C6H5-CHO} \ce{\(A\) ->[\ce{+H2O}] \(B\)} \ce{SO4^2- + Ba^2+ -> BaSO4 v} $$
{{< mermaid >}} graph LR A --- B B-->C[fa:fa-ban forbidden] B-->D(fa:fa-spinner); {{< /mermaid >}} {{< mermaid >}} graph TD A[Client] --> B[Load Balancer] B --> C[Server1] B --> D[Server2] {{< /mermaid >}}