LaTeX 文档结构:\documentclass 定义类型,\usepackage 加载宏包,$...$ 行内公式,$$...$$ 独立公式。
文档结构
\documentclass{article} % 文档类型
\usepackage{amsmath} % 宏包
\begin{document}
正文内容
\end{document}
文本格式
| 命令 | 效果 |
|---|
\textbf{} | 加粗 |
\textit{} | 斜体 |
\underline{} | 下划线 |
章节层级
\section{一级}
\subsection{二级}
\subsubsection{三级}
数学公式
行内:$a + b = c$
独立:
$$E = mc^2$$
\begin{equation}
\int_a^b f(x) dx
\end{equation}
常用语法
| 功能 | 语法 | 效果 |
|---|
| 上标 | x^2 | x2 |
| 下标 | a_i | ai |
| 分式 | \frac{a}{b} | ba |
| 根号 | \sqrt{x} | x |
| 求和 | \sum_{i=1}^n | ∑i=1n |
| 积分 | \int_a^b | ∫ab |
| 极限 | \lim_{x \to 0} | limx→0 |
集合符号
| 符号 | 命令 |
|---|
| ∈ | \in |
| ∈/ | \notin |
| ⊆ | \subseteq |
| ∪ | \cup |
| ∩ | \cap |
| ∅ | \emptyset |
| ∀ | \forall |
| ∃ | \exists |
数集
矩阵
\begin{pmatrix} a & b \\ c & d \end{pmatrix}
\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
概率统计
| 符号 | 命令 |
|---|
| P(A) | P(A) |
| E[X] | \mathbb{E}[X] |
| Var(X) | \mathrm{Var}(X) |
| X∼N(μ,σ2) | X \sim N(\mu, \sigma^2) |
必备宏包
\usepackage{amsmath, amssymb, mathtools}