# LaTeX 备忘清单 & latex cheatsheet & Quick Reference

## 入门

### 介绍

LaTeX 基于 TEX 的排版系统，适用于生成高印刷质量的科技和数学、物理文档。

- LaTeX 官网 (latex-project.org)
- KaTeX 官网 (katex.org)

而 KaTeX 只处理 LaTeX 的数学符号的一个更小的子集，用于 web 上展示

### 示例

    f(x)=∫−∞∞fξ^ e2πiξx dξ% \f is defined as #1f(#2) using the macro
    f\relax(x) = \int_{-\infty}^\infty
        f\hat\xi\,e^{2 \pi i \xi x}
        \,d\xi
    f(x)=∫−∞∞​fξ^​e2πiξxdξ

    % \f is defined as #1f(#2) using the macro
    f\relax(x) = \int_{-\infty}^\infty
        f\hat\xi\,e^{2 \pi i \xi x}
        \,d\xi

### 行内展示

    基于 KaTeX 在一行
    展示示例： `KaTeX:\int_0^\infty x^2 dx`

基于 KaTeX 在一行展示示例： `∫0∞x2dx\int_0^\infty x^2 dx∫0∞​x2dx`

## Supported Functions

### Accents

:- | :- | :-
--- | --- | ---
`a′a'a′` <pur>`a'`</pur> | `a~\tilde{a}a~` <pur>`\tilde{a}`</pur> | `g˚\mathring{g}g˚​` <pur>`\mathring{g}`</pur>
`a′′a''a′′` <pur>`a''`</pur> | `ac~\widetilde{ac}ac` <pur>`\widetilde{ac}`</pur> | `AB⏠\overgroup{AB}AB` <pur>`\overgroup{AB}`</pur>
`a′a^{\prime}a′` <pur>`a^{\prime}`</pur> | `AB~\utilde{AB} AB​` <pur>`\utilde{AB}`</pur> | `AB⏡\undergroup{AB} AB​` <pur>`\undergroup{AB}`</pur>
`aˊ\acute{a}aˊ` <pur>`\acute{a}`</pur> | `F⃗\vec{F}F` <pur>`\vec{F}`</pur> | `AB⇒\Overrightarrow{AB}AB` <pur>`\Overrightarrow{AB}`</pur>
`yˉ\bar{y}yˉ​` <pur>`\bar{y}`</pur> | `AB←\overleftarrow{AB}AB` <pur>`\overleftarrow{AB}`</pur> | `AB→\overrightarrow{AB}AB` <pur>`\overrightarrow{AB}`</pur>
`a˘\breve{a}a˘` <pur>`\breve{a}`</pur> | `AB←\underleftarrow{AB} AB​` <pur>`\underleftarrow{AB}`</pur> | `AB→\underrightarrow{AB} AB​` <pur>`\underrightarrow{AB}`</pur>
`aˇ\check{a}aˇ` <pur>`\check{a}`</pur> | `ac↼\overleftharpoon{ac}ac` <pur>`\overleftharpoon{ac}`</pur> | `ac⇀\overrightharpoon{ac}ac` <pur>`\overrightharpoon{ac}`</pur>
`a˙\dot{a}a˙` <pur>`\dot{a}`</pur> | `AB↔\overleftrightarrow{AB}AB` <pur>`\overleftrightarrow{AB}`</pur> | `AB⏞\overbrace{AB}AB` <pur>`\overbrace{AB}`</pur>
`a¨\ddot{a}a¨` <pur>`\ddot{a}`</pur> | `AB↔\underleftrightarrow{AB} AB​` <pur>`\underleftrightarrow{AB}`</pur> | `AB⏟\underbrace{AB} AB​` <pur>`\underbrace{AB}`</pur>
`aˋ\grave{a}aˋ` <pur>`\grave{a}`</pur> | `AB‾\overline{AB}AB` <pur>`\overline{AB}`</pur> | `ABundefined\overlinesegment{AB}AB` <pur>`\overlinesegment{AB}`</pur>
`θ^\hat{\theta}θ^` <pur>`\hat{\theta}`</pur> | `AB‾\underline{AB}AB​` <pur>`\underline{AB}`</pur> | `ABundefined\underlinesegment{AB} AB​` <pur>`\underlinesegment{AB}`</pur>
`ac^\widehat{ac}ac` <pur>`\widehat{ac}`</pur> | `acˇ\widecheck{ac}ac` <pur>`\widecheck{ac}`</pur> | `X‾\underbar{X}X​` <pur>`\underbar{X}`</pur>

### \text｛…｝中的强调功能

:- | :- | :-
--- | --- | ---
`aˊ\'{a}aˊ` <pur>`\'{a}`</pur> | `a˜\~{a}a˜` <pur>`\~{a}`</pur> |
`a˙\.{a}a˙` <pur>`\.{a}`</pur> | `a˝\H{a}a˝` <pur>`\H{a}`</pur> |
`aˋ\\\`{a}aˋ` <pur>`\`{a}`</pur> | `aˉ\={a}aˉ` <pur>`\={a}`</pur> |
`a¨\"{a}a¨` <pur>`\"{a}`</pur> | `aˇ\v{a}aˇ` <pur>`\v{a}`</pur> |
`aˆ\^{a}aˆ` <pur>`\^{a}`</pur> | `a˘\u{a}a˘` <pur>`\u{a}`</pur> |
`a˚\r{a}a˚` <pur>`\r{a}`</pur> |  |

### Delimiter Sizing

:- | :-
--- | ---
`(AB)\left(\LARGE{AB}\right)(AB)` | <pur>`\left(\LARGE{AB}\right)`</pur>
`(((((( \big( \Big( \bigg( \Bigg((((((` | <pur>`( \big( \Big( \bigg( \Bigg(`</pur>

:- | :- | :- | :- | :-
--- | --- | --- | --- | ---
`\left` | `\big` | `\bigl` | `\bigm` | `\bigr`
`\middle` | `\Big` | `\Bigl` | `\Bigm` | `\Bigr`
`\right` | `\bigg` | `\biggl` | `\biggm` | `\biggr`
`` | `\Bigg` | `\Biggl` | `\Biggm` | `\Biggr`

### 分隔符 Delimiters

预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
`()()()` | <pur>`()`</pur> | `()\lparen \rparen()` | <pur>`\lparen` `\rparen`</pur> | `⌈⌉⌈ ⌉⌈⌉` | <pur>`⌈ ⌉`</pur> | `⌈⌉\lceil \rceil⌈⌉` | <pur>`\lceil` `\rceil`</pur> | `↑\uparrow↑` | <pur>`\uparrow`</pur>
`[][][]` | <pur>`[]`</pur> | `[]\lbrack \rbrack[]` | <pur>`\lbrack` `\rbrack`</pur> | `⌊⌋⌊ ⌋⌊⌋` | <pur>`⌊ ⌋`</pur> | `⌊⌋\lfloor \rfloor⌊⌋` | <pur>`\lfloor` `\rfloor`</pur> | `↓\downarrow↓` | <pur>`\downarrow`</pur>
`{}\{ \}{}` | <pur>`{}`</pur> | `{}\lbrace \rbrace{}` | <pur>`\lbrace` `\rbrace`</pur> | `⎰⎱⎰⎱⎰⎱` | <pur>`⎰⎱`</pur> | `⎰⎱\lmoustache \rmoustache⎰⎱` | <pur>`\lmoustache` `\rmoustache`</pur> | `↕\updownarrow↕` | <pur>`\updownarrow`</pur>
`⟨⟩⟨ ⟩⟨⟩` | <pur>`⟨⟩`</pur> | `⟨⟩\langle \rangle⟨⟩` | <pur>`\langle` `\rangle`</pur> | `⟮⟯⟮ ⟯⟮⟯` | <pur>`⟮ ⟯`</pur> | `⟮⟯\lgroup \rgroup⟮⟯` | <pur>`\lgroup` `\rgroup`</pur> | `⇑\Uparrow⇑` | <pur>`\Uparrow`</pur>
`∣∣∣` | <pur>`|`</pur> | `∣\vert∣` | <pur>`\vert`</pur> | `┌┐┌ ┐┌┐` | <pur>`┌ ┐`</pur> | `⌜⌝\ulcorner \urcorner┌┐` | <pur>`\ulcorner` `\urcorner`</pur> | `⇓\Downarrow⇓` | <pur>`\Downarrow`</pur>
`∣|∣` (<red>MD语法冲突</red>) | <pur>`\|`</pur> | `∥\Vert∥` | <pur>`\Vert`</pur> | `└┘└ ┘└┘` | <pur>`└ ┘`</pur> | `⌞⌟\llcorner \lrcorner└┘` | <pur>`\llcorner` `\lrcorner`</pur> | `⇕\Updownarrow⇕` | <pur>`\Updownarrow`</pur>
`∣∣∣ ∣∣∣` | <pur>`\lvert` `\rvert`</pur> | `∥∥\lVert \rVert∥∥` | <pur>`\lVert` `\rVert`</pur> |  | <pur>`\left.`</pur> |  | <pur>`\right.`</pur> | `\\backslash\` | <pur>`\backslash`</pur>
`⟨\lang⟨` `⟩\rang⟩` | <pur>`\lang` `\rang`<pur></pur></pur> | `<>\lt \gt<>` | <pur>`\lt \gt`</pur> | `⟦⟧⟦ ⟧[[]]` | <pur>`⟦ ⟧`</pur> | `⟦⟧\llbracket \rrbracket[[]]` | <pur>`\llbracket` `\rrbracket`</pur> | `⦃⦄\lBrace \rBrace{[]}` | <pur>`\lBrace \rBrace`</pur>

## Environments

### Environments 1

    abcd\begin{matrix}
       a & b \\
       c & d
    \end{matrix}
    ac​bd​

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

### Environments 2

    abcd\begin{array}{cc}
       a & b \\
       c & d
    \end{array}
    ac​bd​

    \begin{array}{cc}
       a & b \\
       c & d
    \end{array}

### Environments 3

    (abcd)\begin{pmatrix}
       a & b \\
       c & d
    \end{pmatrix}
    (ac​bd​)

    \begin{pmatrix}
       a & b \\
       c & d
    \end{pmatrix}

### Environments 4

    [abcd]\begin{bmatrix}
       a & b \\
       c & d
    \end{bmatrix}
    [ac​bd​]

    \begin{bmatrix}
       a & b \\
       c & d
    \end{bmatrix}

### Environments 5

    ∣abcd∣\begin{vmatrix}
       a & b \\
       c & d
    \end{vmatrix}
    ∣∣​ac​bd​∣∣​

    \begin{vmatrix}
       a & b \\
       c & d
    \end{vmatrix}

### Environments 6

    ∥abcd∥\begin{Vmatrix}
       a & b \\
       c & d
    \end{Vmatrix}
    ∥∥​ac​bd​∥∥​

    \begin{Vmatrix}
       a & b \\
       c & d
    \end{Vmatrix}

### Environments 7

    {abcd}\begin{Bmatrix}
       a & b \\
       c & d
    \end{Bmatrix}
    {ac​bd​}

    \begin{Bmatrix}
       a & b \\
       c & d
    \end{Bmatrix}

### Environments 8

    abcdefghi\def\arraystretch{1.5}
       \begin{array}{c:c:c}
       a & b & c \\ \hline
       d & e & f \\
       \hdashline
       g & h & i
    \end{array}
    adg​beh​cfi​​

    \def\arraystretch{1.5}
       \begin{array}{c:c:c}
       a & b & c \\ \hline
       d & e & f \\
       \hdashline
       g & h & i
    \end{array}

### Environments 9

    x={aif bcif dx = \begin{cases}
       a &\text{if } b \\
       c &\text{if } d
    \end{cases}
    x={ac​if bif d​

    x = \begin{cases}
       a &\text{if } b \\
       c &\text{if } d
    \end{cases}

### Environments 10

    aif bcif d}⇒…\begin{rcases}
       a &\text{if } b \\
       c &\text{if } d
    \end{rcases}⇒…
    ac​if bif d​}⇒…

    \begin{rcases}
       a &\text{if } b \\
       c &\text{if } d
    \end{rcases}⇒…

### Environments 11

    abcd\begin{smallmatrix}
       a & b \\
       c & d
    \end{smallmatrix}
    ac​bd​

    \begin{smallmatrix}
       a & b \\
       c & d
    \end{smallmatrix}

### Environments 12

    ∑i∈Λ0<j<n\sum_{
    \begin{subarray}{l}
       i\in\Lambda\\
       0<j<n
    \end{subarray}}
    i∈Λ0<j<n​∑​

    \sum_{
    \begin{subarray}{l}
       i\in\Lambda\\
       0<j<n
    \end{subarray}}

### Environments 13

    a=b+c=e+f\begin{equation}
    \begin{split}  a &=b+c\\
          &=e+f
    \end{split}
    \end{equation}
    a​=b+c=e+f​​​

    \begin{equation}
    \begin{split}  a &=b+c\\
          &=e+f
    \end{split}
    \end{equation}

### Environments 14

    a=b+cd+e=f\begin{align}
       a&=b+c \\
       d+e&=f
    \end{align}
    ad+e​=b+c=f​​

    \begin{align}
       a&=b+c \\
       d+e&=f
    \end{align}

### Environments 15

    a=be=b+c\begin{gather}
       a=b \\
       e=b+c
    \end{gather}
    a=be=b+c​​

    \begin{gather}
       a=b \\
       e=b+c
    \end{gather}

### Environments 16

    10x+3y=23x+13y=4\begin{alignat}{2}
       10&x+&3&y=2\\
       3&x+&13&y=4
    \end{alignat}
    103​x+x+​313​y=2y=4​​

    \begin{alignat}{2}
       10&x+&3&y=2\\
       3&x+&13&y=4
    \end{alignat}

### Environments 17

    A→aBb↓↑cC=D\begin{CD}
       A @>a>> B \\
    @VbVV @AAcA \\
       C @= D
    \end{CD}
    Ab↓⏐​C​a​​B⏐↑​cD​

    \begin{CD}
       A @>a>> B \\
    @VbVV @AAcA \\
       C @= D
    \end{CD}

## 另见

- LaTeX 官网 (latex-project.org)
- KaTeX 官网 (katex.org)