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
下标a_i
分式\frac{a}{b}
根号\sqrt{x}
求和\sum_{i=1}^n
积分\int_a^b
极限\lim_{x \to 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)
\mathbb{E}[X]
\mathrm{Var}(X)
X \sim N(\mu, \sigma^2)

必备宏包

\usepackage{amsmath, amssymb, mathtools}