Abstract
Mathematical notation in a Hugo project via Hugo’s embedded instance of the KaTeX.
In this example we will be using KaTeX
Note: Use the online reference of Supported TeX Functions
And the general: LaTeX/Mathematics
Examples
Inline math: φ = 1 + 5 2 = 1.6180339887... \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887... φ = 2 1 + 5 = 1.6180339887...
Block math:
K L ( y ^ ∣ ∣ y ) = ∑ c = 1 M y ^ c log y ^ c y c J S ( y ^ ∣ ∣ y ) = 1 2 ( K L ( y ∣ ∣ y + y ^ 2 ) + K L ( y ^ ∣ ∣ y + y ^ 2 ) )
\begin{aligned}
KL(\hat{y} || y) &= \sum_{c=1}^{M}\hat{y}_c \log{\frac{\hat{y}_c}{y_c}} \\
JS(\hat{y} || y) &= \frac{1}{2}(KL(y||\frac{y+\hat{y}}{2}) + KL(\hat{y}||\frac{y+\hat{y}}{2}))
\end{aligned}
K L ( y ^ ∣∣ y ) J S ( y ^ ∣∣ y ) = c = 1 ∑ M y ^ c log y c y ^ c = 2 1 ( K L ( y ∣∣ 2 y + y ^ ) + K L ( y ^ ∣∣ 2 y + y ^ ))
∑ i = 1 n i = n ( n + 1 ) 2
\sum_{i=1}^{n}{i}=\frac{n(n+1)}{2}
i = 1 ∑ n i = 2 n ( n + 1 ) ∑ 0 < i < m 0 < j < n P ( i , j )
\sum_{\substack{
0<i<m \\
0<j<n
}}
P(i,j)
0 < i < m 0 < j < n ∑ P ( i , j ) ∏ j ≥ 0 ( ∑ k ≥ 0 a j k z k ) = ∑ k ≥ 0 z n ( ∑ k 0 , k 1 , … ≥ 0 k 0 + k 1 + … = n a 0 k 0 a 1 k 1 … )
\begin{equation}
\prod_{j\geq 0}
\left(\sum_{k\geq 0}a_{jk} z^k\right)
= \sum_{k\geq 0} z^n
\left( \sum_{{k_0,k_1,\ldots\geq 0}
\atop{k_0+k_1+\ldots=n} }
a{_0k_0}a_{1k_1}\ldots \right)
\end{equation}
j ≥ 0 ∏ ( k ≥ 0 ∑ a jk z k ) = k ≥ 0 ∑ z n k 0 + k 1 + … = n k 0 , k 1 , … ≥ 0 ∑ a 0 k 0 a 1 k 1 …
∀ x ∈ X , ∃ y ≤ ϵ
\forall x \in X, \quad \exists y \leq \epsilon
∀ x ∈ X , ∃ y ≤ ϵ
α , A , β , B , γ , Γ , π , Π , ϕ , φ , μ , Φ
\alpha, \Alpha, \beta, \Beta, \gamma, \Gamma, \pi, \Pi, \phi, \varphi, \mu, \Phi
α , A , β , B , γ , Γ , π , Π , ϕ , φ , μ , Φ ( a ) , [ b ] , { c } , ∣ d ∣ , ∥ e ∥ , ⟨ f ⟩ , ⌊ g ⌋ , ⌈ h ⌉ , ⌜ i ⌝ , / j \
( a ), [ b ], \{ c \}, | d |, \| e \|,
\langle f \rangle, \lfloor g \rfloor,
\lceil h \rceil, \ulcorner i \urcorner,
/ j \backslash
( a ) , [ b ] , { c } , ∣ d ∣ , ∥ e ∥ , ⟨ f ⟩ , ⌊ g ⌋ , ⌈ h ⌉ , ┌ i ┐ , / j \ cool → ℜ cool ←
\overrightarrow{\text{cool}} \,{\Huge \Re }\;\overleftarrow{\text{cool}}
cool ℜ cool β = ( β 1 , β 2 , … , β n )
\boldsymbol{\beta} = (\beta_1,\beta_2,\dotsc,\beta_n)
β = ( β 1 , β 2 , … , β n )
cos ( 2 θ ) = cos 2 θ − sin 2 θ
\cos (2\theta) = \cos^2 \theta - \sin^2 \theta
cos ( 2 θ ) = cos 2 θ − sin 2 θ
lim x → ∞ exp ( − x ) = 0
\lim\limits_{x \to \infty} \exp(-x) = 0
x → ∞ lim exp ( − x ) = 0
a m o d b x ≡ a ( m o d b )
\begin{aligned}
&a \bmod b \\
&x \equiv a \pmod{b}
\end{aligned}
a mod b x ≡ a ( mod b )
k n + 1 = n 2 + k n 2 − k n − 1
k_{n+1} = n^2 + k_n^2 - k_{n-1}
k n + 1 = n 2 + k n 2 − k n − 1 f ( n ) = n 5 + 4 n 2 + 2 ∣ n = 17
f(n) = n^5 + 4n^2 + 2 |_{n=17}
f ( n ) = n 5 + 4 n 2 + 2 ∣ n = 17
n ! k ! ( n − k ) ! = ( n k )
\frac{n!}{k!(n-k)!} = \binom{n}{k}
k ! ( n − k )! n ! = ( k n ) 1 x + 1 y y − z
\frac{\frac{1}{x}+\frac{1}{y}}{y-z}
y − z x 1 + y 1 ( x 2 y 3 )
\left(\frac{x^2}{y^3}\right)
( y 3 x 2 ) x = a 0 + 1 a 1 + 1 a 2 + 1 a 3 + 1 a 4
\begin{equation}
x = a_0 + \cfrac{1}{a_1
+ \cfrac{1}{a_2
+ \cfrac{1}{a_3 + \cfrac{1}{a_4} } } }
\end{equation}
x = a 0 + a 1 + a 2 + a 3 + a 4 1 1 1 1
a b
\sqrt{\frac{a}{b}}
b a 1 + x + x 2 + x 3 + ⋯ + x n n
\sqrt[n]{1+x+x^2+x^3+\dots+x^n}
n 1 + x + x 2 + x 3 + ⋯ + x n
∫ 0 ∞ e − x d x
\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x
∫ 0 ∞ e − x d x ∫ a b
\int\limits_a^b
a ∫ b ϕ ( t ) = 1 2 π ∫ 0 t e − x 2 / 2 d x
\begin{equation}
\phi(t)=\frac{1}{\sqrt{2\pi}}
\int^t_0 e^{-x^2/2} \mathrm{d}x
\end{equation}
ϕ ( t ) = 2 π 1 ∫ 0 t e − x 2 /2 d x
a b c d e f g h i
\begin{matrix}
a & b & c \\
d & e & f \\
g & h & i
\end{matrix}
a d g b e h c f i − 1 3 2 − 4 = − 1 3 2 − 4
\begin{matrix}
-1 & 3 \\
2 & -4
\end{matrix}=
\begin{matrix*}[r]
-1 & 3 \\
2 & -4
\end{matrix*}
− 1 2 3 − 4 = − 1 2 3 − 4 A m , n = ( a 1 , 1 a 1 , 2 ⋯ a 1 , n a 2 , 1 a 2 , 2 ⋯ a 2 , n ⋮ ⋮ ⋱ ⋮ a m , 1 a m , 2 ⋯ a m , n )
A_{m,n} =
\begin{pmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{pmatrix}
A m , n = a 1 , 1 a 2 , 1 ⋮ a m , 1 a 1 , 2 a 2 , 2 ⋮ a m , 2 ⋯ ⋯ ⋱ ⋯ a 1 , n a 2 , n ⋮ a m , n 1 2 3 4
\begin{array}{c|c}
1 & 2 \\
\hline
3 & 4
\end{array}
1 3 2 4 M = [ 5 6 1 6 0 5 6 0 1 6 0 5 6 1 6 ]
M = \begin{bmatrix}
\frac{5}{6} & \frac{1}{6} & 0 \\[0.3em]
\frac{5}{6} & 0 & \frac{1}{6} \\[0.3em]
0 & \frac{5}{6} & \frac{1}{6}
\end{bmatrix}
M = 6 5 6 5 0 6 1 0 6 5 0 6 1 6 1 A matrix in text must be set smaller:
( a b c d ) \bigl(\begin{smallmatrix} a&b \\ c&d \end{smallmatrix} \bigr) ( a c b d )
to not increase leading in a portion of text.
F ( x , y ) = 0 a n d ∣ F x x ′ ′ F x y ′ ′ F x ′ F y x ′ ′ F y y ′ ′ F y ′ F x ′ F y ′ 0 ∣ = 0
\begin{equation}
{F}(x,y)=0\quad\mathrm{and}\quad
\left|\begin{array}{ccc}
F_{\!xx}'' & F_{\!xy}'' & F_{\!x}' \\[0.3em]
F_{\!yx}'' & F_{\!yy}'' & F_{\!y}' \\[0.3em]
F_{\!x}' & F_{\!y}' & 0
\end{array} \right| =0
\end{equation}
F ( x , y ) = 0 and F xx ′′ F y x ′′ F x ′ F x y ′′ F yy ′′ F y ′ F x ′ F y ′ 0 = 0
k = x − 2
k = {\color{red}x} \mathbin{\color{blue}-} 2
k = x − 2
( ( ( ( (
( \big( \Big( \bigg( \Bigg(
( ( ( ( ( d d x ( k g ( x ) ) d d x ( k g ( x ) ) d d x ( k g ( x ) )
\begin{aligned}
&\frac{\mathrm d}{\mathrm d x} \left( k g(x) \right) \\
&\frac{\mathrm d}{\mathrm d x} \big( k g(x) \big) \\
&\frac{\mathrm d}{\mathrm d x} \Big( k g(x) \Big)
\end{aligned}
d x d ( k g ( x ) ) d x d ( k g ( x ) ) d x d ( k g ( x ) ) { x 2 y 3 }
\left\{\frac{x^2}{y^3}\right\}
{ y 3 x 2 } P ( A = 2 | A 2 B > 4 )
P\left(A=2\middle|\frac{A^2}{B}>4\right)
P ( A = 2 B A 2 > 4 ) x 3 3 ∣ 0 1
\left.\frac{x^3}{3}\right|_0^1
3 x 3 0 1
f ( n ) = { n / 2 if n is even − ( n + 1 ) / 2 if n is odd
f(n) =
\begin{cases}
n/2 & \quad \text{if } n \text{ is even}\\
-(n+1)/2 & \quad \text{if } n \text{ is odd}
\end{cases}
f ( n ) = { n /2 − ( n + 1 ) /2 if n is even if n is odd { ( a , … , a ⏞ k a ′ s , ( b , … , b ⏞ l b ′ s ⏟ k + 1 e l e m e n t s }
\begin{equation}
\{\underbrace{%
\overbrace{\mathstrut a,\ldots,a}^{k\ a's},
\overbrace{\mathstrut b,\ldots,b}^{l\ b's}}
_{k+1\ \mathrm{elements}} \}
\end{equation}
{ k + 1 elements ( a , … , a k a ′ s , ( b , … , b l b ′ s }
50 a p p l e s × 100 a p p l e s = l o t s o f a p p l e s 2
50 apples \times 100 apples = lots of apples^2
50 a ppl es × 100 a ppl es = l o t so f a ppl e s 2 50 apples × 100 apples = lots of apples 2
50 \text{apples} \times 100 \text{apples} = \text{lots of apples}^2
50 apples × 100 apples = lots of apples 2 50 apples × 100 apples = lots of apples 2
50 \text{ apples} \times 100 \text{ apples} = \text{lots of apples}^2
50 apples × 100 apples = lots of apples 2
∫ y d x
\int y \mathrm{d}x
∫ y d x ∫ y d x
\int y\, \mathrm{d}x
∫ y d x ∫ y d x
\int y\: \mathrm{d}x
∫ y d x ∫ y d x
\int y\; \mathrm{d}x
∫ y d x ∫ y d x
\int y\! \mathrm{d}x
∫ y d x ( n r ) = n ! r ! ( n − r ) !
\left(
\begin{array}{c}
n \\
r
\end{array}
\right)
= \frac{n!}{r!(n-r)!}
( n r ) = r ! ( n − r )! n ! ( n r ) = n ! r ! ( n − r ) !
\left(\!
\begin{array}{c}
n \\
r
\end{array}
\!\right)
= \frac{n!}{r!(n-r)!}
( n r ) = r ! ( n − r )! n !