LaTeX 指南
参考资料
推荐资源
公式类型
行内公式
行内公式(Inline Math)是嵌入在文本中的公式,其两侧分别用一个美元符号标记。
$...$
行间公式
行间公式(Math Blocks)是独立成行并居中的公式,其前后分别用两个美元符号进行标记。
$$
...
$$
提示
行内公式的“大小”(如分数的大小、巨运算符上下标的位置)通常比行间公式小。可以使用 \displaystyle
和 \textstyle
切换两种类型。
运算符号
基础
名称 | 演示 | 代码 |
---|---|---|
加号 | + | |
减号 | - | |
乘号 | \times | |
点乘 | \cdot | |
除号 | \div | |
等号 | = 、\eq | |
不等号 | \ne 、\neq | |
约等号 | \approx | |
大于号 | > 、\gt | |
小于号 | < 、\lt | |
大于等于 | \ge 、\geq | |
小于等于 | \le 、\leq | |
正负号 | \pm 、\plusmn | |
无穷 | \infty | |
根号 | , | \sqrt{x} ,\sqrt[y]{x} |
分数 | \frac{a}{b} | |
上取整 | 、 | \lceil 、\rceil |
下取整 | 、 | \lfloor 、\rfloor |
大括号 | , | \lbrace 、\{ ,\rbrace 、\} |
逻辑
名称 | 演示 | 代码 |
---|---|---|
与 | \land | |
或 | \lor | |
非 | \lnot | |
推出 | , | \implies ,\Rightarrow |
反推 | , | \impliedby ,\Leftarrow |
等价 | , | \iff ,\Leftrightarrow |
因为 | \because | |
所以 | \therefore |
巨运算符
求和
\sum_{i=1}^{n} a_i
http://localhost:3000
求积
\prod_{i=1}^{n} a_i
http://localhost:3000
积分
\int_{a}^{b} f(x) \mathrm{d}x
http://localhost:3000
极限
\lim_{x\to\infty} f(x)
http://localhost:3000
多行公式
递等式
\begin{aligned}
f(x) &= a \\
&= b \\
&= c
\end{aligned}
http://localhost:3000
分段函数
f(x)=
\begin{cases}
a & x>0 \\
b & x=0 \\
c & x<0
\end{cases}
http://localhost:3000
线性方程组
\begin{cases}
a_1x + b_1y + c_1z = d_1 \\
a_2x + b_2y + c_2z = d_2 \\
a_3x + b_3y + c_3z = d_3
\end{cases}
http://localhost:3000
多行公式
\begin{array}{l}
\cos \pi = 1 \\
\sin^2 a + \cos^2 a = 1 \\
\sin 2a = 2 \sin a \cos a
\end{array}
http://localhost:3000
提示
通过调整 \begin{array}
后的参数,可以设置多行公式的对齐方式:
{c}
表示居中;{l}
表示左对齐;{r}
表示右对齐。
矩阵
\begin{bmatrix}
1 & 0 & \dots & 0 \\
0 & 1 & \dots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \dots & 1
\end{bmatrix}
http://localhost:3000
更多功能
边框
\boxed{a^2+b^2=c^2}
http://localhost:3000
颜色
{\color{White}\colorbox{Red}{FBI WARNING}}
http://localhost:3000
字体
正体
g\approx 9.8\mathrm{m/s^2}
http://localhost:3000
黑板粗体
x\in\mathbb{R}
http://localhost:3000
自定义运算符
\operatorname{lca}{(6,8)}=24
http://localhost:3000
编号
\tag{1} (a+b)^2=a^2+2ab+b^2
http://localhost:3000