Learning Latex

2026.03.05

Learning Latex

Preface

Latex is an advanced typesetting system that is primarily used for scientific and technical reports

Since MO and OI are always accompanied by a large number of formulas, I’ve wanted to learn LaTeX for several years. However, I’ve been using LaTeX editors instead of typing formulas by hand until now. I believe that typing formulas manually is an extremely useful skill, especially when writing problem solutions. Not only switching between editors and the article is exhausting, using the editor’s interface itself is also cumbersome. It always takes a long time to find a single symbol, making it far less efficient than manual typing.

As a markup language (similar to Markdown), I believe the best way to learn it is through practice and gradual progress.

The following is my actual process of learning LaTeX. Try to type out each of the following formulas in a LaTeX renderer by yourself.


Learning & Practicing

Unless otherwise stated by me, the following are wrapped in \begin{equation} and \end{equation}:

$a^b$a^b
$\frac{a}{b}$\frac{a}{b}
$\sqrt{a}$\sqrt{a}
$\pm$\pm

$$\begin{equation} a^2 + b^2 = c^2 \end{equation}$$

$$\begin{equation} x = \frac{-b \pm \sqrt{b^2-4ac}}{2a} \end{equation}$$

$\sin$\sin
$\vec{a}$\vec{a}
$a_b$a_b
$a \cdot b$a \cdot b
$|$|
$\cos$\cos
$\theta$\theta
$a \neq b$a \neq b

$$\begin{equation} \frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} = 2R \end{equation}$$

$$\begin{equation} a \cdot b = | a | | b | \cos \theta \end{equation}$$

$$\begin{equation} S_n = \frac{a_1(1-q^n)}{1-q} (q \neq 1) \end{equation}$$

$\sum_{i=0}^{n}$\sum_{i=0}^{n}
$\binom{n}{k}$\binom{n}{k}
$x^{n+1}$x^{n+1}
$a_i^k$a_i^k
$\leq$\leq
$a \equiv b$a \equiv b
$\pmod{p}$\pmod{p}

$$\begin{equation} (x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k}y^k \end{equation}$$

$$\begin{equation} (\sum_{i=1}^{n} a_ib_i)^2 \leq (\sum_{i=1}^{n}a_i^2)(\sum_{i=1}^{n}b_i^2) \end{equation}$$

$$\begin{equation} a^{p-1} \equiv 1 \pmod{p} \end{equation}$$

$\int_{a}^{b}$\int_{a}^{b}
$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$\begin{pmatrix} a & b \\ c & d \end{pmatrix}

$$\begin{equation} \int_{a}^{b} f(x) dx = F(b) - F(a) \end{equation}$$

$$\begin{equation} A = \begin{pmatrix}a & b \\ c & d \end{pmatrix} \end{equation}$$

I think I have a general understanding of LaTeX now. I will start learning it all over again from the formulas encountered in primary school.

$a \times b$a \times b
$a \div b$a \div b
$ \geq $\geq
$\approx$\approx
$\%$\%
$\dots$\dots

$$\begin{equation} 12 \times 3 \div 6 = 6 \end{equation}$$

$$\begin{equation} 85\% \approx 0.85 \geq \frac{4}{5} \end{equation}$$

$$\begin{equation} \frac{\sqrt{25}\times[(10+2)\div 3]^2}{100\%}\approx 16.0 \end{equation}$$

$$\begin{equation} 10\div 3 = 3 \dots 1 \end{equation}$$

$\pi$\pi
$^\circ$^\circ
$\triangle$\triangle
$\cong$\cong

$$\begin{equation} S = \pi \times r^2 \end{equation}$$

$$\begin{equation} 180^\circ = \pi \end{equation}$$

$$\begin{equation} \triangle ABC \cong \triangle DEF \end{equation}$$

$\because$\because
$\therefore$\therefore

Note that the next two examples are wrapped in \begin{aligned} and \end{aligned}:
(please use \begin{aligned} and \end{aligned} whenever multiple lines appear in the future)

(line break)\\
(vertical alignment position of each line)&
\begin{aligned} &\because a = b, b = c \\\\ &\therefore a = c \end{aligned}

$$\begin{aligned} &\because a = b, b = c \\ &\therefore a = c \end{aligned}$$

\begin{aligned} &12\times 4 + 15 \\\\ &=48+15 \\\\ &=63 \end{aligned}

$$\begin{aligned} &12\times 4 + 15\\ &=48+15\\ &=63 \end{aligned}$$

$\perp$\perp
$\parallel$\parallel
$\sim$\sim
$\cong$\cong
$\angle$\angle
$\odot$\odot
$\stackrel{\frown}{AB}$\stackrel{\frown}{AB}
$\frown$\frown
$\text{Ciallo~(∠・ω< )}$\text{Ciallo~(∠・ω< )}

$$\begin{equation} \text{in} \odot O, \text{if} \stackrel{\frown}{AB} = \stackrel{\frown}{CD}, \text{then} \angle AOB = \angle COD. \end{equation}$$

$$\begin{equation} \text{if} AB \perp CD \text{, } AB \perp EF \text{, then} CD \parallel EF \end{equation}$$

$$\begin{equation} \text{if} \triangle ABC \sim \triangle DEF \text{, } AB = DE \text{, then} \triangle ABC \cong \triangle DEF \end{equation}$$

$\implies$\implies
$\in$\in
$\notin$\notin
$\subseteq$\subseteq
$\subsetneq$\subsetneq
$\cap$\cap
$\cup$\cup
$\exists$\exists
$\forall$\forall
$\emptyset$\emptyset

$$\begin{equation} \forall x \in A, x \in B \implies A \subseteq B \end{equation}$$

$$\begin{equation} \forall x \in A, x \in B \text{, and } \exist y \in B, y\notin A \implies A \subsetneq B \end{equation}$$

$$\begin{equation} A \cap B = \{ x | x \in A \text{ and } x \in B \} \end{equation}$$

$$\begin{equation} \emptyset = \{ x | x \neq x \} \end{equation}$$

$\neg$\neg
$\iff$\iff

$$\begin{equation} \text{Preposition }p: \forall x \in M, p(x) \iff \neg p: \exists x_0 \in M, \neg p(x_0) \end{equation}$$

$\mathbb{R}$\mathbb{R}
$\log_a N$\log_a N
$\log_{10} N$\log_{10} N
$\ln$\ln
$\infty$\infty
$$\lim_{x \to a}$$\lim_{x \to a}
$\to$\to

$$\begin{equation} \forall x \in \mathbb{R} , x^2 \geq 0 \end{equation}$$

$$\begin{equation} \mathbb{N} \subsetneq \mathbb{Z} \subsetneq \mathbb{Q} \subsetneq \mathbb{R} \subsetneq \mathbb{C} \end{equation}$$

$$\begin{equation} \log_a N = x \iff a^x = N (a>0,a\neq 1, N>0) \end{equation}$$

$$\begin{equation} \ln x = \log_e x \text{, } \lg x = \log_{10} x, \forall \text{, } \in (0, +\infty) \end{equation}$$

$$\begin{equation} \forall a, b, c > 0 (a, c \neq 1), \log_a b = \frac{\ln b}{\ln a} = \frac{\lg b}{\lg a} = \frac{\log_c b}{\log_c a} \end{equation}$$

$$\begin{equation} \forall x \in \mathbb{Q}, f(x) = \ln(e^x + 1) \implies \lim_{x \to +\infty} f(x) = \infty \end{equation}$$

$\overrightarrow{AB}$\overrightarrow{AB}

$$\begin{equation} \overrightarrow{AB} + \overrightarrow{BC} = \overrightarrow{AC} \end{equation}$$

$\arg(z)$\arg(z)
$\bar{z}$\bar(z)
$\overline{z+w}$\overline(z+w)
$z^*$z^*

$$\begin{equation} | z | = \sqrt{a^2+b^2} \end{equation}$$

$$\begin{equation} \overline{z \cdot w} = \bar{z} \cdot \bar{w} \end{equation}$$

$\sum_{cyc}$\sum_{cyc}
$\prod_{cyc}$\prod_{cyc}

$$\begin{equation} \sum_{sym} a^2 b=a^2b+a^2c+b^2a+b^2c+c^2a+c^2b \end{equation}$$

$$\begin{equation} \sum_{cyc} \frac{a}{b+c} \geq \frac{3}{2} \end{equation}$$

$$\begin{equation} \sum_{cyc} a^2(a-b)(a-c) \geq 0 \end{equation}$$

$$\begin{equation} \prod_{cyc}(a+b)\geq 8abc \end{equation}$$

$$\begin{equation} \sum_{cyc} \frac{a^2 + bc}{b+c} \geq a+b+c \end{equation}$$

$\lfloor x \rfloor$\lfloor x \rfloor
$\lceil x \rceil\lceil x \rceil
$ \{ x \} $\{ x \}
$\circ$\circ

$$\begin{equation} \lfloor x \rfloor + \lfloor x + \frac{1}{2} \rfloor = \lfloor 2x \rfloor \end{equation}$$

$$\begin{equation} \sum_{k=0}^{n-1} \lfloor x + \frac{k}{n} \rfloor = \lfloor nx \rfloor \end{equation}$$

$$\begin{equation} \{ x \} + \{ -x \} = 1 (if x ) \end{equation}$$

$$\begin{equation} (f \circ f)(x) = f(f(x)) \end{equation}$$

$\deg(P)$\deg(P)
$\dots$\dots

$$\begin{equation} P(x) = a_nx^n+a_{n-1}x^{n-1} + \dots + a_1x+a_0 \end{equation}$$

$$\begin{equation} \sum_{1\leq i \leq j \leq n} x_ix_j = \frac{a_{n-2}}{a_n} \end{equation}$$

$$\begin{equation} \deg(P\cdot Q) = \deg(P) + \deg(Q) \end{equation}$$

$$\begin{equation} L(x) = \sum_{j=0}^{n} y_i \prod_{i \neq j} \frac{x-x_i}{x_j-x_i} \end{equation}$$

$$\begin{equation} P(x) = a_n(x-x_1)(x-x_2)\dots(x-x_n) \end{equation}$$

$f: A\to B$f: A\to B
$\mathbb{R}^+$\mathbb{R}^+
$\mapsto$\mapsto

$$\begin{equation} f: \mathbb{R} \to \mathbb{R} \end{equation}$$

$$\begin{equation} f(x+y) = f(x) + f(y), \forall x,y \in \mathbb{Q} \end{equation}$$

$$\begin{equation} x \mapsto x^2 + c \end{equation}$$

Parentheses Matrix (pmatrix) & Vertical Bar Matrix (vmatrix):

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$\begin{pmatrix} a & b \\ c & d \end{pmatrix}
$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$\begin{vmatrix} a & b \\ c & d \end{vmatrix}
$\det(A)$\det(A)

$$\begin{equation} \begin{pmatrix} F_{n+1} \\ F_n\end{pmatrix} = \begin{pmatrix} 1 & 1 \\ 1 & 0 \end{pmatrix} ^ n \begin{pmatrix} F_1 \\F_0\end{pmatrix} \end{equation}$$

$$\begin{equation} \det(\lambda I - A) = 0 \end{equation}$$

$$\begin{equation} V_n = \prod_{1\leq i \leq j \leq n} (x_j-x_i) \end{equation}$$

$\sum_{\substack{i = 1 \\ i \neq j}}$\sum_{\substack{i = 1 \\ i \neq j}}

$$\begin{equation} \sum_{\substack{i = 1 \\ i\neq j}}^n \frac{1}{x_i-x_j} \end{equation}$$

$$\begin{equation} \sum_{\substack{a,b,c\in \mathbb{n} \\ a+b+c=n \\ a,b,c\geq 1}} \frac{n!}{a!b!c!} \end{equation}$$

$$\begin{equation} \sum_{\substack{cyc\\a,b,c\geq 0}} \frac{a}{b+c} \end{equation}$$

$$\begin{equation} \sum_{\substack{S\subseteq \{ 1, \dots, n \} \\ |S| = k}} \prod_{i\in S} x_i \end{equation}$$

$$\begin{equation} \sum_{\substack{1<i<j<n\\a_i+a_j = S}} a_ia_j \end{equation}$$

Note the use of \begin{aligned} and \end{aligned} :
(After breaking lines with \\,use & at the position where alignment is needed on each line)

$$\begin{aligned} \sum_{i = 1}^{n} (a_i + b_i)^2 & = \sum_{i=1}^n(a_i^2+2a_ib_i+b_i^2) \\ & = \sum_{i=1}^n a_i^2 + 2\sum_{i=1}^n a_ib_i + \sum_{i=1}^n b_i^2 \end{aligned}$$

$$\begin{aligned} \sum_{i = 1}^{n} a(b - c)^2 & = a(b-c)^2 + b(c-a)^2 + c(a-b)^2 \\ & = \sum_{sym} a^2b - 6abc \end{aligned}$$

$\| a \|$\| a \|
$\langle a \rangle $\langle a \rangle
$\hat{u}$\hat{u}
$\Delta$\Delta
$\nabla$\nabla
$\mathcal{A,B,C}$\mathcal{A,B,C}
$\coloneqq$\coloneqq
$\binom{k}{x}$\binom{k}{x}

$$\begin{equation} \| fg \|_1 \leq \|f\|_p\|g\|_q \end{equation}$$

$$\begin{equation} \|x+y\| \leq \|x \| + \| y \| \end{equation}$$

$$\begin{equation} \langle f, q \rangle = \int_a^b f(x)g(x) dx \end{equation}$$

$$\begin{equation} \|f\|_\infty = \sup | f(x) | \end{equation}$$

$$\begin{equation} \hat{u} = \frac{u}{\|u\|} \end{equation}$$

$$\begin{equation} \Delta f(x) = f(x+1)-f(x) \end{equation}$$

$$\begin{equation} \nabla f(x) = f(x) - f(x-1) \end{equation}$$

$$\begin{equation} P(x) = \sum_{k=0}^n \binom{k}{x} \Delta ^ k P(0) \end{equation}$$

$$\begin{equation} \Delta (f(x)g(x))=f(x)\Delta g(x)+g(x+1)\Delta f(x) \end{equation}$$

$$\begin{equation} \mathcal{F} = \{f|f:R\to R \} \end{equation}$$

$$\left\| \sum_{cyc}a \right\| $$\left\| \sum_{cyc}a \right\|

$$\begin{equation} \forall f \in \mathcal{C} [0,1] \left\|f-\sum_{k=0}^n a_kx^k \right\| \coloneqq max_{x\in [0,1]} |f(x)-P_n(x)| \end{equation}$$

$\mid$\mid
$\nmid$\nmid
$\equiv$\equiv
$\pmod{m}$\pmod{m}

$$\begin{equation} d \mid a \text{ and } d \mid b \implies d \mid \gcd(a,b) \end{equation}$$

$$\begin{equation} a \equiv b \pmod{m} \implies a^n \equiv b^n \pmod{m} \end{equation}$$

$$\begin{equation} (p-1)! \equiv -1 \pmod{p} \end{equation}$$

$$\begin{equation} \forall n > 1, n \nmid (2^n - 1) \end{equation}$$

$\phi(n)$\phi(n)
$\tau(n)$\tau(n)
$\sigma(n)$\sigma(n)
$\mu(n)$\mu(n)
$\omega(n)$\omega(n)

$$\begin{equation} \phi(n) = n \prod _{p\mid n} \left(1-\frac{1}{p}\right) \end{equation}$$

$$\begin{equation} \sigma(n) = \sum_{d\mid n} d \end{equation}$$

$$\begin{equation} \sum_{d\mid n} \mu(d) = \lfloor \frac{1}{n} \rfloor \end{equation}$$

$$\begin{equation} \sum_{d\mid n} \mu(d) = \lfloor \frac{1}{n} \rfloor \end{equation}$$

$$\begin{equation} (f*g)(n) = \sum_{d \mid n} f(d)g(\frac{n}{d}) \end{equation}$$

$$\begin{equation} \sum_{n\leq x} \tau(n) = x\ln x + (2\gamma - 1)x + O(\sqrt{x}) \end{equation}$$

$\left( \frac{a}{p} \right)$\left( \frac{a}{p} \right)
$\nu_p(n)$\nu_p(n)

$$\begin{equation} \left(\frac{p}{q} \right) \left(\frac{q}{p} \right) = (-1)^{\frac{p-1}{2}\frac{q-1}{2}} \end{equation}$$

$$\begin{equation} \nu_p(n!) = \sum_{k=1}^{\infty} \lfloor \frac{n}{p^k} \rfloor \end{equation}$$

$$\begin{equation} \left( \frac{a}{n} \right) = \left( \frac{a}{p_1} \right)^{\alpha_1} \dots \left( \frac{a}{p_k} \right)^{\alpha_k} \end{equation}$$

$\zeta(k)$\zeta(k)
$\psi(x)$\psi(x)
$\sim$\sim

$$\begin{equation} \pi(x) \sim \frac{x}{\ln x} \end{equation}$$

$$\begin{equation} \zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s} = \prod_p \frac{1}{1-p^{-s}} \end{equation}$$

$$\begin{equation} \psi(x) = \sum_{p^k\leq x} \ln p \end{equation}$$

$$\begin{equation} \prod_{p\leq x} \left(1-\frac{1}{p} \right) \approx \frac{e^{-\gamma}}{\ln x} \end{equation}$$

$\begin{matrix} m \\ k \end{matrix}$\begin{matrix} m \\ k \end{matrix}
$\left\{ \begin{matrix} m \\ k \end{matrix} \right\}$\left\{ \begin{matrix} m \\ k \end{matrix} \right\}
$\left[ \begin{matrix} m \\ k \end{matrix} \right]$\left[ \begin{matrix} m \\ k \end{matrix} \right]
$$\binom{m}{k}$$\binom{m}{k}
$$

$$\begin{equation} n! = n \times (n-1) \times \dots \times 1 \end{equation}$$

$$\begin{equation} P_n^k = A_n^k = \frac{n!}{(n-k)!} \end{equation}$$

$$\begin{equation} \binom{n}{k} = \frac{n!}{k!(n-k)!} \end{equation}$$

$$\begin{equation} \sum_{i=0}^k \binom{n}{i} \binom{m}{k-i} = \binom{n+m}{k} \end{equation}$$

$$\begin{equation} \binom{n}{k_1,k_2,\dots,k_m} = \frac{n!}{k_1!k_2!\dots k_m!} \end{equation}$$

$$\begin{equation} D_n = n!\sum_{i=0}^{n} \frac{(-1)^i}{i!}s \end{equation}$$

$$\begin{equation} |\cup_{i=1}^n A_i | = \sum | A_i | - \sum | A_i \cap A_j| + \dots + (-1)^{n-1} | A_1 \cap \dots \cap A_n | \end{equation}$$

$$\begin{equation} E[ \sum X_i ] = \sum E [X_i] \end{equation}$$

$$\begin{equation} \sum_{u\in V} d(v) = 2|E| \end{equation}$$

$$\begin{equation} R(k,l) \leq \binom{k+l-2}{k-1} \end{equation}$$

$$\begin{equation} \forall S \subseteq X, |N(S)| \geq |S| \end{equation}$$

$$\begin{equation} A(x) = \sum_{n=0}^\infty a_n x^n \end{equation}$$

$$\begin{equation} \hat{A}(x) = \sum_{n=0}^\infty a_n \frac{x^n}{n!} \end{equation}$$

$$\begin{equation} \sum_{n \equiv r \pmod{k}} \binom{N}{n} = \frac{1}{k} \sum_{j=0}^{k-1} \omega ^{-jr}(1+\omega ^j)^N \end{equation}$$

$$\begin{equation} [x^n]\frac{1}{(1-x)^k} = \binom{n+k-1}{k-1} \end{equation}$$

$$\begin{equation} n^m = \sum_{k=0}^n \left\{ \begin{matrix} m \\ k \end{matrix} \right\} \binom{n}{k} k! \end{equation}$$

$\Omega(n)$\Omega(n)
$\Theta(n)$\Theta(n)
$A \land B$A \land B
$A \lor B$A \lor B
$A \oplus B$A \oplus B
$\neg A$\neg A
$x\ll1$x\ll1
$x\gg1$x\gg1
$a\&b$a\&b

\land : ‘Logical AND’
\lor : ‘Logical OR’
\ll : ‘Much Less Than’ (Less Less)
\gg : ‘Much Greater Than’ (Greater Greater)

$$\begin{equation} T(n) = O(g(n)) \end{equation}$$

$$\begin{equation} T(n) = \Omega(g(n)) \end{equation}$$

$$\begin{equation} T(n) = \Theta(g(n)) \end{equation}$$

$$\begin{equation} T(n) = aT(\frac{n}{b})+f(n) \end{equation}$$

$$\begin{equation} T(n) = aT(\frac{n}{b})+f(n) \end{equation}$$

$$\begin{equation} \neg(P\land Q) \iff (\neg P) \lor (\neg Q) \end{equation}$$

$$\begin{equation} \neg(P\lor Q) \iff (\neg P) \land (\neg Q) \end{equation}$$

$$\begin{equation} P \land (Q \lor R) \iff (P \land Q) \lor (P \land R) \end{equation}$$

$$\begin{equation} (P \implies Q) \iff (\neg P \lor Q) \end{equation}$$

$$\begin{equation} P \oplus Q \iff (P\lor Q)\land \neg(P \land Q) \end{equation}$$

$$\begin{equation} a + b = (a\oplus b )+ 2(a \& b) \end{equation}$$

$$\begin{equation} x \ll n = x \cdot 2^n \end{equation}$$

$$\begin{equation} x \gg n = \lfloor x/2^n \rfloor \end{equation}$$

$$\bigoplus_{i=1}^n$$\bigoplus_{i=1}^n

$$\begin{equation} \sum_{i=1}^n (a_i \oplus x) \leq K \iff \neg \left( \bigoplus_{i=1}^n a_i > \text{limit} \right) \end{equation}$$


$$\begin{equation} \mathcal{P}(\mathbf{x}, t) = \frac{\displaystyle \sum_{n=1}^{\infty} \oint_{\partial \Omega} \Psi_{n}(\mathbf{r}) e^{-\alpha_n t} , d\mathbf{S}}{\displaystyle \left[ \det\left( \mathbf{A} \otimes \mathbf{B} - \lambda \mathbf{I} \right) \right]^{\frac{1}{2}}} \cdot \exp\left( -\int_{0}^{t} \left| \frac{\partial \mathbf{u}}{\partial \tau} \right|^2_{L^2(\Omega)} d\tau \right) \end{equation}$$

$$\begin{equation} \mathcal{P}(\omega) = \frac{1}{2\pi} \int_{-\infty}^{\infty} \left[ \sum_{n=1}^{N} \sqrt{\frac{\alpha_n \beta_n}{\omega^2 + \gamma_n^2}} \right] e^{-i\omega t} , \mathrm{d}\omega + \oint_{\Gamma} \frac{z^2 + \alpha}{\sin(\pi z)} , \mathrm{d}z \end{equation}$$


I think I’ve practiced all the symbols I normally use, so I’ll leave it at that for now.
Finding the symbols and formulas plus manually writing this article took a total of about five hours, and it was a very rewarding experience. Since I’ll be practicing this whenever I write problem solutions in the future, there’s no need for deliberate practice anymore.