Markdown 中的 LaTeX 数学公式指南

1. 基本语法结构

1.1 行内公式

$公式内容$  例如:$E = mc^2$
\(E = mc^2\)

1.2 块级公式

$$公式内容$$  例如:
$$\sum_{i=1}^n i = \frac{n(n+1)}{2}$$
$\(\sum_{i=1}^n i = \frac{n(n+1)}{2}\)$

1.3 环境语法

\begin{环境名}
内容
\end{环境名}

2. 希腊字母

小写 大写
\alpha α \Alpha Α
\beta β \Beta B
\gamma γ \Gamma Γ
\delta δ \Delta Δ
\epsilon ε \Epsilon E
\zeta ζ \Zeta Z
\eta η \Eta H
\theta θ \Theta Θ
\iota ι \Iota I
\kappa κ \Kappa K
\lambda λ \Lambda Λ
\mu μ \Mu M
\nu ν \Nu N
\xi ξ \Xi Ξ
\pi π \Pi Π
\rho ρ \Rho P
\sigma σ \Sigma Σ
\tau τ \Tau T
\upsilon υ \Upsilon Υ
\phi φ \Phi Φ
\chi χ \Chi X
\psi ψ \Psi Ψ
\omega ω \Omega Ω

3. 数学运算符

3.1 基本运算

+ - \times \div \cdot \pm \mp
\(+ - \times \div \cdot \pm \mp\)

3.2 关系运算符

= \neq < > \leq \geq \approx \equiv \propto
\(= \neq < > \leq \geq \approx \equiv \propto\)

3.3 集合运算符

\in \notin \subset \subseteq \supset \supseteq \cup \cap \emptyset
\(\in \notin \subset \subseteq \supset \supseteq \cup \cap \emptyset\)

3.4 微积分

\frac{dy}{dx} \int_a^b f(x)dx \iint \oint \lim_{x \to \infty}
\partial \nabla \sum \prod
\(\frac{dy}{dx} \int_a^b f(x)dx \iint \oint \lim_{x \to \infty} \partial \nabla \sum \prod\)

3.5 逻辑运算符

\forall \exists \neg \land \lor \rightarrow \Rightarrow \Leftrightarrow
\(\forall \exists \neg \land \lor \rightarrow \Rightarrow \Leftrightarrow\)

4. 上下标与括号

4.1 上下标

x^2   x^{a+b}   x_i   x_{ij}   \max_{x \in S}
\(x^2 x^{a+b} x_i x_{ij} \max_{x \in S}\)

4.2 括号与定界符

( ) [ ] \{ \} \langle \rangle | \| \lceil \rceil \lfloor \rfloor

4.3 自动调整大小

\left( \frac{a}{b} \right) \quad \Bigg( \bigg( \Big( \big( 
$\left( \frac{a}{b} \right) \quad \Bigg( \bigg( \Big( \big( $

5. 矩阵与数组

5.1 基础矩阵

\begin{matrix}
a & b \\
c & d
\end{matrix}
$$ \begin{matrix} a & b \ c & d \end{matrix} $$

5.2 带括号矩阵

\begin{pmatrix} a & b \\ c & d \end{pmatrix}
\begin{bmatrix} a & b \\ c & d \end{bmatrix}
\begin{Bmatrix} a & b \\ c & d \end{Bmatrix}
$$\begin{pmatrix} a & b \ c & d \end{pmatrix} \begin{bmatrix} a & b \ c & d \end{bmatrix} \begin{Bmatrix} a & b \ c & d \end{Bmatrix} $$

5.3 分段函数

f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x & \text{if } x < 0
\end{cases}
$$f(x) = \begin{cases} x^2 & \text{if } x \geq 0 \ -x & \text{if } x < 0 \end{cases} $$

6. 特殊符号

6.1 箭头

\rightarrow \Rightarrow \leftarrow \Leftarrow \leftrightarrow \Leftrightarrow
\mapsto \to \hookrightarrow \nearrow \searrow
\(\rightarrow \Rightarrow \leftarrow \Leftarrow \leftrightarrow \Leftrightarrow \mapsto \to \hookrightarrow \nearrow \searrow\)

6.2 几何符号

\angle \triangle \square \cong \sim \parallel \perp
\(\angle \triangle \square \cong \sim \parallel \perp\)

6.3 其他符号

\infty \aleph \hbar \ell \wp \Re \Im \prime \emptyset \nabla \partial
\(\infty \aleph \hbar \ell \wp \Re \Im \prime \emptyset \nabla \partial\)

7. 格式与间距

7.1 文本格式

\text{普通文本} \textrm{罗马体} \textit{斜体} \mathbf{粗体} \mathsf{等线体}
\mathbb{黑板粗体} \mathcal{手写体}
\(\text{普通文本} \textrm{罗马体} \textit{斜体} \mathbf{粗体} \mathsf{等线体} \mathbb{黑板粗体} \mathcal{手写体}\)

7.2 空格与间距

\,   \:   \;   \quad   \qquad   \!   \hspace{1cm}   \vspace{5mm}

7.3 对齐环境

\begin{align}
x &= y + z \\
a &= b \times c
\end{align}
$$ \begin{align} x &= y + z \ a &= b \times c \end{align} $$

8. 定理与证明环境

8.1 定理环境

\begin{theorem}[Pythagoras]
a^2 + b^2 = c^2
\end{theorem}

8.2 证明环境

\begin{proof}
由定义可知...
\end{proof}

9. 化学表达式(需 mhchem 包)

\ce{H2O}   \ce{SO4^2-}   \ce{^{227}_{90}Th}   \ce{A ->[H2O] B}
$$ \ce{H2O} \ce{SO4^2-} \ce{^{227}_{90}Th} \ce{A ->[H2O] B} $$

10. 完整示例

10.1 行内示例

勾股定理:$a^2 + b^2 = c^2$
\(a^2 + b^2 = c^2\)

10.2 块级示例

$$
\Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt
$$

$$
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
$$

$$
\forall x \in \mathbb{R}, \quad \exists y \quad \text{使得} \quad |x - y| < \epsilon
$$
$$ \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt $$

\[ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} \]
\[ \forall x \in \mathbb{R}, \quad \exists y \quad \text{使得} \quad |x - y| < \epsilon \]