## 入门

### 介绍

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`

### 希腊和希伯来字母 Greek and Hebrew letters

预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
`α\alphaα` | <pur>`\alpha`</pur> | `κ\kappaκ` | <pur>`\kappa`</pur> | `ψ\psiψ` | <pur>`\psi`</pur> | `ϝ\digammaϝ` | <pur>`\digamma`</pur> | `Δ\DeltaΔ` | <pur>`\Delta`</pur> | `Θ\ThetaΘ` | <pur>`\Theta`</pur>
`β\betaβ` | <pur>`\beta`</pur> | `λ\lambdaλ` | <pur>`\lambda`</pur> | `ρ\rhoρ` | <pur>`\rho`</pur> | `ε\varepsilonε` | <pur>`\varepsilon`</pur> | `Γ\GammaΓ` | <pur>`\Gamma`</pur> | `Υ\UpsilonΥ` | <pur>`\Upsilon`</pur>
`χ\chiχ` | <pur>`\chi`</pur> | `μ\muμ` | <pur>`\mu`</pur> | `σ\sigmaσ` | <pur>`\sigma`</pur> | `ϰ\varkappaϰ` | <pur>`\varkappa`</pur> | `Λ\LambdaΛ` | <pur>`\Lambda`</pur> | `Ξ\XiΞ` | <pur>`\Xi`</pur>
`δ\deltaδ` | <pur>`\delta`</pur> | `ν\nuν` | <pur>`\nu`</pur> | `τ\tauτ` | <pur>`\tau`</pur> | `φ\varphiφ` | <pur>`\varphi`</pur> | `Ω\OmegaΩ` | <pur>`\Omega`</pur> |  |
`ϵ\epsilonϵ` | <pur>`\epsilon`</pur> | `ooo` | <pur>`o`</pur> | `θ\thetaθ` | <pur>`\theta`</pur> | `ϖ\varpiϖ` | <pur>`\varpi`</pur> | `Φ\PhiΦ` | <pur>`\Phi`</pur> | `ℵ\alephℵ` | <pur>`\aleph`</pur>
`η\etaη` | <pur>`\eta`</pur> | `ω\omegaω` | <pur>`\omega`</pur> | `υ\upsilonυ` | <pur>`\upsilon`</pur> | `ϱ\varrhoϱ` | <pur>`\varrho`</pur> | `Π\PiΠ` | <pur>`\Pi`</pur> | `ℶ\bethℶ` | <pur>`\beth`</pur>
`γ\gammaγ` | <pur>`\gamma`</pur> | `ϕ\phiϕ` | <pur>`\phi`</pur> | `ξ\xiξ` | <pur>`\xi`</pur> | `ς\varsigmaς` | <pur>`\varsigma`</pur> | `Ψ\PsiΨ` | <pur>`\Psi`</pur> | `ℸ\dalethℸ` | <pur>`\daleth`</pur>
`ι\iotaι` | <pur>`\iota`</pur> | `π\piπ` | <pur>`\pi`</pur> | `ζ\zetaζ` | <pur>`\zeta`</pur> | `ϑ\varthetaϑ` | <pur>`\vartheta`</pur> | `Σ\SigmaΣ` | <pur>`\Sigma`</pur> | `ℷ\gimelℷ` | <pur>`\gimel`</pur>

### `LaTeX\LaTeXLATE​X` math constructs

预览 | 方法 | 预览 | 方法 | 预览 | 方法
--- | --- | --- | --- | --- | ---
`abcxyz\frac{abc}{xyz}xyzabc​` | <pur>`\frac{abc}{xyz}`</pur> | `abc‾\overline{abc}abc` | <pur>`\overline{abc}`</pur> | `abc→\overrightarrow{abc}abc` | <pur>`\overrightarrow{abc}`</pur>
`f’f’f’` | <pur>`f’`</pur> | `abc‾\underline{abc}abc​` | <pur>`\underline{abc}`</pur> | `abc←\overleftarrow{abc}abc` | <pur>`\overleftarrow{abc}`</pur>
`abc\sqrt{abc}abc ​` | <pur>`\sqrt{abc}`</pur> | `abc^\widehat{abc}abc` | <pur>`\widehat{abc}`</pur> | `abc⏞\overbrace{abc}abc` | <pur>`\overbrace{abc}`</pur>
`abcn\sqrt[n]{abc}nabc ​` | <pur>`\sqrt[n]{abc}`</pur> | `abc~\widetilde{abc}abc` | <pur>`\widetilde{abc}`</pur> | `abc⏟\underbrace{abc} abc​` | <pur>`\underbrace{abc}`</pur>

### 分隔符 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>

可以使用一对表达式 `\left` `s1s_1s1​` 和 `\right` `s2s_2s2​` 来将分隔符 `s1s_1s1​` 和 `s2s_2s2​` 的高度与其内容的高度进行匹配，例如:

:- | :- | :- | :- | :- | :- | :- | :- | :- | :- | :-
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
`\left|` | `exprexprexpr` | `\right|` |  | `\left\{` | `exprexprexpr` | `\right\}` |  | `\left\Vert` | `exprexprexpr` | `\right.`

### Variable-sized symbols

预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
`∑\sum∑` | <pur>`\sum`</pur> | `∫\int∫` | <pur>`\int`</pur> | `⨄\biguplus⨄` | <pur>`\biguplus`</pur> | `⨁\bigoplus⨁` | <pur>`\bigoplus`</pur> | `⋁\bigvee⋁` | <pur>`\bigvee`</pur>
`∏\prod∏` | <pur>`\prod`</pur> | `∮\oint∮` | <pur>`\oint`</pur> | `⋂\bigcap⋂` | <pur>`\bigcap`</pur> | `⨂\bigotimes⨂` | <pur>`\bigotimes`</pur> | `⋀\bigwedge⋀` | <pur>`\bigwedge`</pur>
`∐\coprod∐` | <pur>`\coprod`</pur> | `∬\iint∬` | <pur>`\iint`</pur> | `⋃\bigcup⋃` | <pur>`\bigcup`</pur> | `⨀\bigodot⨀` | <pur>`\bigodot`</pur> | `⨀\bigodot⨀` | <pur>`\bigodot`</pur>

### Standard Function Names

预览 | 方法 | 预览 | 方法 | 预览 | 方法 | 预览 | 方法
--- | --- | --- | --- | --- | --- | --- | ---
`arccos⁡\arccosarccos` | <pur>`\arccos`</pur> | `arcsin⁡\arcsinarcsin` | <pur>`\arcsin`</pur> | `arcsin⁡\arcsinarcsin` | <pur>`\arcsin`</pur> | `arg⁡\argarg` | <pur>`\arg`</pur>
`cos⁡\coscos` | <pur>`\cos`</pur> | `cosh⁡\coshcosh` | <pur>`\cosh`</pur> | `cot⁡\cotcot` | <pur>`\cot`</pur> | `coth⁡\cothcoth` | <pur>`\coth`</pur>
`csc⁡\csccsc` | <pur>`\csc`</pur> | `deg⁡\degdeg` | <pur>`\deg`</pur> | `det⁡\detdet` | <pur>`\det`</pur> | `dim⁡\dimdim` | <pur>`\dim`</pur>
`exp⁡\expexp` | <pur>`\exp`</pur> | `gcd⁡\gcdgcd` | <pur>`\gcd`</pur> | `hom⁡\homhom` | <pur>`\hom`</pur> | `inf⁡\infinf` | <pur>`\inf`</pur>
`ker⁡\kerker` | <pur>`\ker`</pur> | `lg⁡\lglg` | <pur>`\lg`</pur> | `lim⁡\limlim` | <pur>`\lim`</pur> | `lim inf⁡\liminfliminf` | <pur>`\liminf`</pur>
`lim sup⁡\limsuplimsup` | <pur>`\limsup`</pur> | `ln⁡\lnln` | <pur>`\ln`</pur> | `log⁡\loglog` | <pur>`\log`</pur> | `max⁡\maxmax` | <pur>`\max`</pur>
`min⁡\minmin` | <pur>`\min`</pur> | `Pr⁡\PrPr` | <pur>`\Pr`</pur> | `sec⁡\secsec` | <pur>`\sec`</pur> | `sin⁡\sinsin` | <pur>`\sin`</pur>
`sinh⁡\sinhsinh` | <pur>`\sinh`</pur> | `sup⁡\supsup` | <pur>`\sup`</pur> | `tan⁡\tantan` | <pur>`\tan`</pur> | `tanh⁡\tanhtanh` | <pur>`\tanh`</pur>

函数名应该用罗马字体，而不是斜体，例如:

:- | :- | :- | :-
--- | --- | --- | ---
Correct: | <pur>`\tan(at-n\pi)`</pur> | `→\rightarrow→` | `tan⁡(at−nπ)\tan(at-n\pi)tan(at−nπ)`
Incorrect: | <pur>`tan(at-n\pi)`</pur> | `→\rightarrow→` | `tan(at−nπ)tan(at-n\pi)tan(at−nπ)`

## 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)
- symbols.pdf (cmor-faculty.rice.edu)