LaTeX

字符间的空隙

描述 代码 效果
两个quad a\qquad b $a\qquad b$
quad a\quadb $a\quad b$
大空格 a\ b $a\ b$
中空格 a\;b $a\;b$
小空格 a\,b $a\,b$
冇空格 ab $ab$
紧 $\;$ 贴 a\!b $a!b$

模式

数学公式的展示中主要有两种形式

  • 行内公式: 适用与短小的公式
  • 行间公式: 适用于较长, 想要独占一行的公式, 可以在公式末尾加入\tag{n} 进行手动编号

行内公式

使用 $ 公式代码 $ 进行表示, 例如:
公式: $ f(x) = a+b $是嵌在行内的
公式: $ f(x) = a+b $是嵌在行内的

行间公式

使用 $$ 公式代码 $$ 进行表示, 并加上编号, 例如:
公式: $$ f(x) = a+b \tag{4.2}$$是嵌在行间的
公式: 是嵌在行间的

运算符号

大多数都可以直接输入, 除了几个特殊字符:

符号 代码 效果
点乘 a\cdot b $a\cdot b$
不等号 a\neq b $a\neq b$
恒等于 a \equiv b $a \equiv b$
取模 a \bmod b $a \bmod b$

上下标号

1
$$ a_{ij}^{2} + b^3_{2}=x^{t} + y' + x''_{12} $$

根号、分式

1
$$\sqrt{x} + \sqrt{x^{2}+\sqrt{y} } = \sqrt[3]{k_{i} } - \frac{x}{m}$$

上下标记

1
$$\overline{x+y} \qquad \underline{a+b}$$
1
$$\overbrace{1+2+\cdots+n}^{n个} \qquad \underbrace{a+b+\cdots+z}_{26}$$

向量

1
$$\vec{a} + \overrightarrow{AB} + \overleftarrow{DE}$$

积分、极限、求和、乘积

1
$$  \lim_{x \to \infty} x^2_{22} - \int_{1}^{5}x\mathrm{d}x + \sum_{n=1}^{20} n^{2} = \prod_{j=1}^{3} y_{j}  + \lim_{x \to -2} \frac{x-2}{x} $$

三圆点

1
$$ x_{1},x_{2},\ldots,x_{5}  \quad x_{1} + x_{2} + \cdots + x_{n} $$

重音符号

1
$$ \hat{x} \bar{x} \tilde{x} $$

矩阵

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$$\begin{matrix}
1 & 2 & \cdots \\
67 & 95 & \cdots \\
\vdots & \vdots & \ddots \\
\end{matrix}$$

$$\begin{bmatrix}
1 & 2 & \cdots \\
67 & 95 & \cdots \\
\vdots & \vdots & \ddots \\
\end{bmatrix}$$

$$\begin{vmatrix}
1 & 2 & \cdots \\
67 & 95 & \cdots \\
\vdots & \vdots & \ddots \\
\end{vmatrix}$$

$$\begin{pmatrix}
1 & 2 & \cdots \\
67 & 95 & \cdots \\
\vdots & \vdots & \ddots \\
\end{pmatrix}$$

$\begin{matrix}
1 & 2 & \cdots \
67 & 95 & \cdots \
\vdots & \vdots & \ddots \
\end{matrix}$

$\begin{bmatrix}
1 & 2 & \cdots \
67 & 95 & \cdots \
\vdots & \vdots & \ddots \
\end{bmatrix}$

$\begin{vmatrix}
1 & 2 & \cdots \
67 & 95 & \cdots \
\vdots & \vdots & \ddots \
\end{vmatrix}$

$\begin{pmatrix}
1 & 2 & \cdots \
67 & 95 & \cdots \
\vdots & \vdots & \ddots \
\end{pmatrix}$

希腊字母

1
$$ \alpha^{2} + \beta = \Theta  $$

多行公式

组合

1
2
3
4
5
$$D(x) = \begin{cases}
\lim\limits_{x \to 0} \frac{a^x}{b+c}, & x<3 \\
\pi, & x=3 \\
\int_a^{3b}x_{ij}+e^2 \mathrm{d}x,& x>3 \\
\end{cases}$$

拆分公式

1
2
3
4
$$\begin{split}
\cos 2x &= \cos^2x - \sin^2x \\
&=2\cos^2x-1
\end{split}$$

括号

1
2
3
4
5
6
7
8
$$
\sigma(s,i) = \left\{
\begin{array}{ll}
\tau_{si} & \mbox{si } \{s,i\} \in E \\
\infty & \mbox{sinon.}
\end{array}
\right.
$$
1
2
3
4
5
6
7
8
$$
\left.
\begin{array}{ll}
\tau_{si} & \mbox{si } \{s,i\} \in E \\
\infty & \mbox{sinon.}
\end{array}
\right \}=\sigma(s,i)
$$
1
2
3
4
$$
\underbrace{\ln \left( \frac{5}{6} \right)}_{\simeq -0.1823}
< \overbrace{\exp \left(\frac{1}{2} \right)}^{\simeq 1.6487}
$$

参考

LaTeX/Mathematics

Author: Sean
Link: https://blog.whileaway.io/posts/63534/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.