LaTex formula syntax

Formula position

In-line formula

1
inline: $a^2 + b^2 = c^2$

inline:

Line

1
2
3
4
line:
$$
a^2 + b^2 = c^2
$$

line:

Mathematical symbol

Subscript

1
\sum_{K = 1}^3 ka^x + y \neq a^{x + y}

Deriative symbol

1
f(x) = x^2 \quad f'(x) = 2x \quad f''^{2} = 4

Fraction

1
3/8 \quad \frac{3}{8} \quad \dfrac{3, 8}	\quad \tfrac{3}{8} 

Combination

1
\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1} 

Probability

1
2
3
P(A) \quad P(A \mid B) 
\mathbb{E}(X) \quad \Var \quad V(X) \quad \sigma(X) \quad \sigma(X, Y) \quad \rho(X, Y) \quad X \sim Y \quad A \perp B
\hat p \quad \bar x

Radical

1
2
3
\sqrt{x} \Leftrightarrow x^{1/2} 
\quad \sqrt[3]{2}
\quad \sqrt{x^2 + \sqrt{y}}

Infinity

1
\infty

Ellipsis

1
2
a_1, a_2, \dots, a_n 
a_1, a_2, \cdots, a_n

Relationship symbol

1
2
3
4
5
6
f_n(x) \approx 1
f_n(x) \neq 1
f_n(x) \equal 1
f_n(x) &= 1
f_n(x) &\leq 1
f_n(x) &\geq 1

Symbol

1
2
3
4
\sum_{i = 1}^n \quad
\int_0^{\frac{\pi}{\2}} \quad
\oint_0^{\frac{\pi}{\2}} \quad
\prod_\epsilon

Limit symbol

1
2
\sum\limits_{i=1}^n \quad
\int\limits_0^{\frac{\pi}{2}}

1
2
3
\prod_{k_0,k_1,\ldots>0\atop 
k_0+k_1+\cdots=n}
{A_{k_0}A_{k_0}\cdots}

1
2
3
\lim_{x \to +\infty} \\
\lim_{x \to -\infty} \\
\lim_{x \to 0}

1
{\lim_{x \to 0} \frac{3x^2 + 7x^3}{x^2 + 5x^4}}

Norm

1
\lVert x^2 \rVert

Gradient

1
\nabla

Partial deriative symbol

1
\left.\frac{\partial f(x, y)}{\partial x}\right|_{x=0}

Integral

1
2
\int_a^b f(x)mathrm{d}x
\int_a^b f(x)\,\mathrm{d}x

1
2
3
4
5
\newcommand\diff{\,\mathrm{d}}
\int\int f(x)g(x) \diff x \diff y \\
\int\!\!\!\int f(x)g(y) \diff x \diff y \\
\iint f(x)g(y) \diff x \diff y \\
\iint \quad \iiint \quad \idotsint

Related symbol

1
2
\in \quad \notin \quad \emptyset \quad \subset \quad
\subseteq \quad \cap \quad \cup \quad \bigcap \quad \bigcup

Mathematical stress and upper and lower bracket

1
2
3
\bar{x_0} \quad \bar{x}_0 \\
\vec{x_0} \quad \vec{x}_0 \\
\hat{\mathbf{e}_x} \quad \hat{\mathbf{e}}_x

1
2
3
0.\overline{3} = \underline{\underline{1/3}} \\
\hat{XY} \quad \widehat{XY} \\
\vec{AB} \quad \overrightarrow{AB}

1
\underbrace{\overbrace{a + b + c} ^ 6 \cdot \overbrace{d + e + f}^7}_\text{meaning of life} = 42

Arrow

1
2
a \xleftarrow{x+y+z} b \\
c \xrightarrow{x<y}{a*b*c}d

$$
\begin{align}
a &\xleftarrow{x+y+z} b \notag \
c &\xrightarrow[x<y]{abc} d \notag
\end{align}
$$

Brackets and delimiters

1
{a, b, c} \neq \{a.b.c\}

1
2
3
4
5
\left[
1 + \left(\frac{1}{1-x^{2}}\right)^3 \qquad
\left.\frac{\partial f}{\partial t}
\right|_{t=0}
\right]

Multi-line formula

1
2
3
4
5
6
7
\begin{equation}
\begin{aligned}
a + b + c + d + e + f+ g + h + i &= j + k + l + m + n \\
&= o + p + q + r + s \\
&= t + u + v + x + z
\end{aligned}
\end{equation}

1
2
3
4
5
\begin{multline}
a + b + c \\
= e + f + g \\
= h + i + j
\end{multline}

1
2
3
4
\begin{align}
a &= b + c \\
&= d + e
\end{align}

1
2
3
4
5
6
7
\begin{align} 
a ={} & b + c \\
={} & d + e + f + g + h + i
+ j + k + l \notag \\
& + m + n + o \\
={} & p + q + r + s
\end{align}

$$
\begin{align}
a ={} & b + c \
={} & d + e + f + g + h + i

  • j + k + l \notag \
    & + m + n + o \
    ={} & p + q + r + s
    \end{align}
    $$
1
2
3
4
\begin{align}
a &=1 & b &=2 & c &=3 \\
d &=-1 & e &=-2 & f &=-5
\end{align}

1
2
3
4
5
6
7
8
\begin{equation} 
\begin{aligned}
a &= b + c \\
d &= e + f + g \\
h + i &= j + k \\
l + m &= n
\end{aligned}
\end{equation}

1
2
3
4
5
6
\begin{gather}
a = b + c \\
d = e + f + g \\
h + i = j + k \notag \\
l + m = n
\end{gather}

Matrix

1
2
3
4
5
6
7
8
\mathbf{X} = \left(
\begin{array}{cccc}
x_{11} & x_{12} & \ldots & x_{1n} \\
x_{21} & x_{22} & \ldots & x_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
x_{n1} & x_{n2} & \ldots & x_{nn} \\
\end{array}
\right)

1
2
3
4
5
6
7
|x| = \left\{
\begin{array}{rl}
-x & \text{if } x < 0, \\
0 & \text{if } x = 0, \\
x & \text{if } x > 0. \\
\end{array}
\right.

$$
|x| = \left{

\right.
$$

1
2
3
4
5
6
|x| = 
\begin{cases}
-x & \text{if } x < 0, \\
0 & \text{if } x = 0, \\
x & \text{if } x > 0. \\
\end{cases}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}

\begin{bmatrix}
x_{11} & x_{12} & \ldots & x_{1n}\\
x_{21} & x_{22} & \ldots & x_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
x_{n1} & x_{n2} & \ldots & x_{nn}\\
\end{bmatrix}

\begin{vmatrix}
1 & 2 \\
3 & 4
\end{vmatrix}

pmatrix (、bmatrix [、Bmatrix{、vmatrix|、Vmatrix||

1
2
3
4
5
6
7
\mathbf{H}=
\begin{bmatrix}
\dfrac{\partial^2 f}{\partial x^2} &
\dfrac{\partial^2 f}{\partial x \partial y} \\
\dfrac{\partial^2 f}{\partial x \partial y} &
\dfrac{\partial^2 f}{\partial y^2}
\end{bmatrix}

Mathematical letter

1
2
3
\mathcal{R} \quad \mathfrak{R} \quad \mathbb{R}
\mathcal{L} = -\frac{1}{4}F_{\mu\nu}F^{\mu\nu}
\mu \quad \sigma \quad \epsilon

1
2
3
4
5
6
P = \frac
{\sum_{i=1}^n (x_i- x)(y_i- y)}
{\displaystyle \left[
\sum_{i=1}^n (x_i-x)^2
\sum_{i=1}^n (y_i-y)^2
\right]^{1/2} }

Symbol table

List of space types

Two quad spaces a \qquad b 2m width
Quad space a \quad b m width
Large space a \␣ b 1/3 m width
Mid space a \; b 2/7 m width
Small space a \, b 1/6 m width
No spaces ab Default
Close to a \! b Indent 1/6 m width

General symbol for text/math mode

Symbol Command Symbol Command
${$ { § \S
Extra close brace or missing open brace} } %
$$$ $ \dots

Binary relation

Symbol Command Symbol Command Symbol Command
< > =
\leq or \le \geq or \ge \equiv
\ll \gg \doteq
\prec \succ \sim
\preceq \succeq \simeq
\subset \supset \approx
\subseteq \supseteq \cong
\sqsubset \sqsupset \Join
\sqsubseteq \sqsupseteq \bowtie
\in \ni or \owns \propto
\vdash \dashv \models
\mid \parallel \perp
\smile \frown \asymp
: \notin \neq or \ne

Binary operator

Symbol Command Symbol Command Symbol Command
+ - \triangleleft
\pm \mp \triangleright
\cdot \div \star
\times \setminus \ast
\cup \cap \circ
\sqcup \sqcap \bullet
\vee, \lor \wedge,\land \diamond
\odot \oslash \otimes
\bigcirc \bigtriangleup \bigtriangledown

Greek alphabet

Symbol Command Symbol Command Symbol Command Symbol Command
\alpha \theta o \upsilon
\beta \vartheta \pi \phi
\gamma \iota \varpi \varphi
\delta \kappa \rho \chi
\epsilon \lambda \varrho \psi
\varepsilon \mu \sigma \omega
\zeta \nu \varsigma
\eta \xi \tau
Symbol Command Symbol Command Symbol Command Symbol Command
\Gamma \Lambda \Sigma \Psi
\Delta \Xi \Upsilon \Omega
\Theta \Pi \Phi
\varGamma \varLambda \varSigma \varPsi
\varDelta \varXi \varUpsilon \varOmega
\varTheta \varPi \varPhi
Symbol Command English phonetic English Commonly referred to
/‘ælfə/ alpha Angle, coefficient, angular acceleration, first, degree of ionization, conversion rate
/‘beɪtə/ beta Flux coefficient, angle, coefficient
/‘gæmə/ gamma Conductivity, angle, specific heat capacity ratio
/‘deltə/ delta Change, enthalpy change, entropy change, diopter, discriminant in one-dimensional quadratic equation, chemical shift
/‘epsɪlɒn/ epsilon Base of logarithm, dielectric constant, permittivity, strain
/‘zi:tə/ zeta Coefficient, azimuth angle, impedance, relative viscosity
/‘i:tə/ eta Hysteresis coefficient, mechanical efficiency
/‘θi:tə/ theta Temperature, angle
/aɪ’əʊtə/ iota Tiny, a little
/‘kæpə/ kappa Dielectric constant, adiabatic index
/‘læmdə/ lambda Planck constant of wavelength, volume, thermal conductivity
/mju:/ mu Permeability, micro, dynamic friction system (factor), hydrodynamic viscosity, currency unit, Möbius function
/nju:/ nu Magnetoresistance coefficient, fluid kinematic viscosity, light wave frequency, stoichiometric number
/ˈsaɪ/ xi Random variable, an unknown specific value in a (small) interval
o /ˈɑmɪˌkrɑn/ omicron Higher-order infinitesimal function
/paɪ/ pi Represents the number of prime numbers not greater than n, multiplication
/rəʊ/ rho Resistivity, polar diameter, density, radius of curvature in cylindrical and polar coordinates
/‘sɪɡmə/ sigma Sum, surface density, transconductance, stress, conductivity
/tɔ:/ tau Time constant, shear stress, (Twice the pi)
/ˈʌpsɪlɒn/ upsilon Displacement
/faɪ/ phi Magnetic flux, electric flux, angle, lens power, heat flow, electric potential, diameter, Euler function, empty set
/kaɪ/ chi There is chi-square in statistics () distributed
/ps/ psi Angular velocity, dielectric flux, Function, magnetic link
/‘əʊmɪɡə/ omega Ohm, angular velocity, angular frequency, electrical angle of alternating current, mass fraction in chemistry, degree of unsaturation

Notation

\sum \bigcup \bigvee
\prod \bigcap \bigwedge
\coprod \bigsqcup \biguplus
\int \oint \bigodot
\bigoplus \bigotimes \idotsint
\iint \iiint \iiiint

Mathematical ascent

\hat{a} \check{a} \tilde{a}
\acute{a} \grave{a} \breve{a}
\bar{a} \vec{a} \mathring{a}
\dot{a} \ddot{a} \dddot{a}
\ddddot{a} \widehat{AAA} \widetilde{AAA}

Arrows

\leftarrow or \gets \longleftarrow
\rightarrow or \to \longrightarrow
\leftrightarrow \longleftrightarrow
\Leftarrow \Longleftarrow
\Rightarrow \Longrightarrow
\Leftrightarrow \Longleftrightarrow
\leftharpoonup \rightharpoonup
\leftharpoondown \rightharpoondown
\rightleftharpoons \updownarrow
\uparrow \downarrow
\overrightarrow{AB} \underrightarrow{AB}
\overleftarrow{AB} \underleftarrow{AB}
\overleftrightarrow{AB} \underleftrightarrow{AB}

Delimiters

( ) ${$ \{
[ ] Extra close brace or missing open brace} \}
\langle \rangle \vert
/ \backslash \Vert
\lgroup \rgroup \lmoustache
\arrowvert \Arrowvert \bracevert
\rmoustache

Other

\dots \cdots \vdots \ddots
\forall \exists \prime \Box
\emptyset \infty \nabla \triangle
\bot \top \angle \surd

References