Math Typesetting

2019-03-08
documentation
math markdown


Mathematical notation in a Hugo project can be enabled by using the third party JavaScript library MathJax.

In the following examples we will be using MathJax

Examples

Inline math starts and ends with %$:

Inline math: %$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… %$

Inline math: %$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… %$

Block math on the other hand starts and ends with $$:

$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$

$$\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }$$

$$ \left[\begin{array} {rrr} 3.381563 & 3.389113 \\ 4.527875 & 5.854178 \\ 2.655682 & 4.411995 \\ \vdots & \vdots \end{array}\right] $$

$$ f(n) = \begin{cases} \frac{n}{2}, & \text{if } n\text{ is even} \\ 3n+1, & \text{if } n\text{ is odd} \end{cases} $$

$$ \begin{aligned} \nabla \times \vec{\mathbf{B}} -, \frac1c, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}, +, \frac1c, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} $$

$$ \underbrace{\frac{\partial}{\partial t}\int_{V}\rho dV}{\text{Rate of change of mass}} =\underbrace{-\oint{S}\rho\underline{v}\cdot\underline{n}dS}_{\text{Net inflow of mass}} $$

$$ \mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\ \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \end{vmatrix} $$