数值风云

LaTeX数学公式语法速查

论坛添加了discourse-math插件,该插件集成了:

可以将大部分LaTeX公式或符号转化并展示在网页上,在本论坛中的使用方式有两种:

  1. 公式前后各使用一个$将其包围起来的行内模式 a=b+c ,注意公式前$前和公式后$后都必须有空格: $a=b+c$
  2. 在新行使用$$起头,另起一行写公式,最后以新行$$结尾:
$$
a=b+c
$$
a=b+c

本文用于记录常用的LaTeX符号以及语法,供各位速查用。

希腊字母、希伯来字母、数学符号

Greek alphabet in LaTeX

小写 大写 LaTeX 小写 大写 LaTeX
\alpha{} A \alpha{} A \nu{} N \nu{} N
\beta B \beta B \xi \Xi \xi \Xi
\gamma \Gamma \gamma \Gamma \omicron O \omicron O
\delta \Delta \delta \Delta \pi \Pi{} \pi \Pi{}
\epsilon E \epsilon E \rho P \rho P
\zeta Z \zeta Z \sigma \Sigma \sigma \Sigma
\eta H \eta H \tau T \tau T
\theta \Theta \theta \Theta \upsilon \Upsilon \upsilon \Upsilon
\iota I \iota I \phi \Phi \phi \Phi
\kappa K \kappa K \chi X \chi X
\lambda \Lambda \lambda \Lambda \psi \Psi \psi \Psi
\mu M \iota I \omega \Omega \omega \Omega

Mathematical variable in LaTeX

符号 LaTeX 符号 LaTeX
\varepsilon{} \varepsilon{} \varrho{} \varrho{}
\vartheta{} \vartheta{} \varphi{} \varphi{}
\varPi{} \varPi{} \varpi{} \varpi{}
\varGamma{} \varGamma{} \varDelta{} \varDelta{}
\varSigma{} \varSigma{} \varUpsilon{} \varUpsilon{}
\varTheta{} \varTheta{} \varPhi{} \varPhi{}
\varLambda{} \varLambda{} \varPsi{} \varPsi{}
\varXi{} \varXi{} \varOmega{} \varOmega{}
\varsigma{} \varsigma{} \varkappa{} \varkappa{}
\digamma{} \digamma{} \beth{} \beth{}
\daleth{} \daleth{} \gimel{} \gimel{}

特殊字符、上标、连接符

Special character I

符号 LaTeX 符号 LaTeX 符号 LaTeX 符号 LaTeX
\dots \dots \cdots \cdots \vdots \vdots \ddots \ddots
\hbar \hbar \imath \imath \jmath \jmath \ell \ell
\Re \Re \Im \Im \aleph \aleph \wp \wp
\forall \forall \exists \exists \nexists \nexists \surd \surd
a^\prime a^\prime \prime \prime \emptyset \emptyset \infty \infty
\nabla \nabla \triangle \triangle \Box \Box \Diamond \Diamond
\bot \bot \top \top \mho \mho \partial \partial
\diamondsuit \diamondsuit \heartsuit \heartsuit \clubsuit \clubsuit \spadesuit \spadesuit
\lnot \neg \lnot \flat \flat \natural \natural \sharp \sharp

Special character II

符号 LaTeX 符号 LaTeX
\hslash \hslash \Bbbk \Bbbk
\square \square \blacksquare \blacksquare
\vartriangle \vartriangle \blacktriangle \blacktriangle
\triangledown \triangledown \blacktriangledown \blacktriangledown
\lozenge \lozenge \blacklozenge \blacklozenge
\eth \eth \bigstar \bigstar
\circledS \circledS \Game \Game
\complement \complement \varnothing \varnothing
\angle \angle \measuredangle \measuredangle
\diagup \diagup \diagdown \diagdown
\complement \complement \backepsilon \backepsilon
\Finv \Finv

Superscript, subscript and connector

上下标 LaTeX 上下标 LaTeX 上下标 LaTeX
\hat{o} \hat{o} \check{o} \check{o} \tilde{o} \tilde{o}
\acute{o} \acute{o} \grave{o} \grave{o} \dot{o} \dot{o}
\breve{o} \breve{o} \bar{o} \bar{o} \ddot{o} \ddot{o}
\widehat{A} \widehat{A} \widetilde{A} \widetilde{A} \vec{o} \vec{o}
\overline{a+b} \overline{a+b} \underline{a+b} \underline{a+b} \underbrace{ a+\cdots }_{n} \underbrace{ a+\cdots }_{n}

向量的表示方法:

\vec{AB}
\vec{AB}
\overrightarrow{AB}
\overrightarrow{AB}

特殊字体

Special alphabet character

特殊字体 LaTeX 特殊字体 LaTeX 特殊字体 LaTeX
\mathrm{ABCdef} \mathrm{ABCdef} \mathit{ABCdef} \mathit{ABCdef} \mathbf{ABCdef} \mathbf{ABCdef}
\mathfrak{ABCdef} \mathfrak{ABCdef} \mathcal{ABC} \mathcal{ABC} \mathsf{ABCdef} \mathsf{ABCdef}
\mathscr{ABC} \mathscr{ABC} \mathbb{ABC} \mathbb{ABC} \mathtt{ABCdef} \mathtt{ABCdef}
\mit{ABCdef} \mit{ABCdef}

常见的应用有:
傅里叶变换\mathcal{F} \mathcal{F} 或者\mathscr{F} \mathscr{F}
拉格朗日函数\mathcal{L} \mathcal{L} 或者\mathscr{L} \mathscr{L}

黑体与斜体的表示方式有:
黑体\textbf{ABCdef} \textbf{ABCdef}
斜体\textit{ABCdef} \textit{ABCdef}

二元关系符

Binary relationship symbol

关系符 LaTeX 关系符 LaTeX 关系符 LaTeX
< < > > = =
\leq \leq \le \geq \geq \ge \equiv \equiv
\ll \ll \gg \gg \doteq \doteq
\prec \prec \succ \succ \sim \sim
\preceq \preceq \succeq \succeq \simeq \simeq
\subset \subset \supset \supset \approx \approx
\subseteq \subseteq \supseteq \supseteq \cong \cong
\nsubseteq \nsubseteq \nsupseteq \nsupseteq \backsimeq \backsimeq
\sqsubset \sqsubset \sqsupset \sqsupset \Join \Join
\sqsubseteq \sqsubseteq \sqsupseteq \sqsupseteq \bowtie \bowtie
\in \in \ni \ni \owns \propto \propto
\vdash \vdash \dashv \dashv \models \models
\mid \mid \parallel \parallel \perp \perp
\smile \smile \frown \frown \asymp \asymp
: : \notin \notin \neq \neq \ne

特殊情况下会用到带有上标的长等号:

\xlongequal{abc}
\xlongequal{abc}

AMS binary relationship symbol

关系符 LaTeX 关系符 LaTeX 关系符 LaTeX
\lessdot \lessdot \gtrdot \gtrdot \doteqdot \doteqdot
\leqslant \leqslant \geqslant \geqslant \risingdotseq \risingdotseq
\eqslantless \eqslantless \eqslantgtr \eqslantgtr \fallingdotseq \fallingdotseq
\leqq \leqq \geqq \geqq \eqcirc \eqcirc
\lll \lll \llless \ggg \ggg \gggtr \circeq \circeq
\lesssim \lesssim \gtrsim \gtrsim \triangleq \triangleq
\lessapprox \lessapprox \gtrapprox \gtrapprox \bumpeq \bumpeq
\lessgtr \lessgtr \gtrless \gtrless \Bumpeq \Bumpeq
\lesseqgtr \lesseqgtr \gtreqless \gtreqless \thicksim \thicksim
\lesseqqgtr \lesseqqgtr \gtreqqless \gtreqqless \thickapprox \thickapprox
\preccurlyeq \preccurlyeq \succcurlyeq \succcurlyeq \approxeq \approxeq
\curlyeqprec \curlyeqprec \curlyeqsucc \curlyeqsucc \backsim \backsim
\precsim \precsim \succsim \succsim \backsimeq \backsimeq
\precapprox \precapprox \succapprox \succapprox \vDash \vDash
\subseteqq \subseteqq \supseteqq \supseteqq \Vdash \Vdash
\Subset \Subset \Supset \Supset \Vvdash \Vvdash
\sqsubset \sqsubset \sqsupset \sqsupset \backepsilon \backepsilon
\therefore \therefore \because \because \varpropto \varpropto
\shortmid \shortmid \shortparallel \shortparallel \between \between
\smallsetminus \smallsetminus \smallfrown \smallfrown \pitchfork \pitchfork
\vartriangleleft \vartriangleleft \vartriangleright \vartriangleright \blacktriangleleft \blacktriangleleft
\trianglelefteq \trianglelefteq \trianglerighteq \trianglerighteq \blacktriangleright \blacktriangleright

二元运算符

Binary operator

运算符 LaTeX 运算符 LaTeX 运算符 LaTeX
+ + - -
\pm \pm \mp \mp \triangleleft \triangleleft
\cdot \cdot \div \div \triangleright \triangleright
\times \times \setminus \setminus \star \star
\cup \cup \cap \cap \ast \ast
\sqcup \sqcup \sqcap \sqcap \circ \circ
\vee \vee \lor \wedge \wedge \land \bullet \bullet
\oplus \oplus \ominus \ominus \diamond \diamond
\odot \odot \oslash \oslash \uplus \uplus
\otimes \otimes \bigcirc \bigcirc \amalg \amalg
\circledast \circledast \circledcirc \circledcirc \circleddash \circleddash
\bigtriangleup \bigtriangleup \bigtriangledown \bigtriangledown \dagger \dagger
\lhd \lhd \rhd \rhd \ddagger \ddagger
\unlhd \unlhd \unrhd \unrhd \wr \wr
\boxplus \boxplus \boxminus \boxminus \boxtimes \boxtimes
\boxdot \boxdot \divideontimes \divideontimes \dotplus \dotplus

分数、上标、下标

3\frac{7}{9}
3\frac{7}{9}
\frac{x^{2}}{k_a+1} \qquad x^{\frac{2}{k_a+1}} \qquad x^{1/2}
\frac{x^{2}}{k_a+1} \qquad x^{\frac{2}{k_a+1}} \qquad x^{1/2}

积分、求和、求积、求极限

积分

积分可以视为积分符号与上下标的组合(在数学模式下,上下标会自动转换为上下限)

\int_{0}^{\frac{\pi}{2}}
\int_{0}^{\frac{\pi}{2}}
\int x^2+y^2
\int x^2+y^2

注意:LaTeX行内模式并不会根据被积分式的高度增大积分符号或整行的高度。实际上公式高度是固定行高,使用时注意不要制造太高的公式。

\oint (\frac{x^2+y^2}{4})^2 dxdy
\oint (\frac{x^2+y^2}{4})^2 dxdy

可以看到上面的积分中括号高度没有自适应,可添加\left\right来解决

\oint \left(\frac{x^2+y^2}{4}\right)^2 dxdy
\oint \left(\frac{x^2+y^2}{4}\right)^2 dxdy
\iint_{D}^{W} dxdy
\iint_{D}^{W} dxdy

求和

\sum_{i=1}^{n}
\sum_{i=1}^{n} 
\sum_{\begin{matrix}\tiny {{i=1,n}} \\ \tiny{{j=1,n}}\end{matrix}}A_{ij}
\sum_{\begin{matrix}\tiny {{i=1,n}} \\ \tiny{{j=1,n}}\end{matrix}}A_{ij}

求积

\prod_\varepsilon A_\varepsilon
\prod_\varepsilon A_\varepsilon

求极限

\lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}
\lim_{n \to \infty} \sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6}

括号与定界符

在上节中我们遇到了括号大小不能自适应的问题,并采用\left与\right标记解决了。接下来详细介绍LaTeX中括号层级定义的技巧:

小括号中括号花括号

直接采用通用数学标记从小到大定义

\left [ \frac{ c\left(a+b^2\right) }{g} \right ] ^2 + e^{iat} \left \{ \frac{\left [ \left ( a+c \right) f -1 \right ]}{2} ^2 \right \}
\left [ \frac{ c\left(a+b^2\right) }{g} \right ] ^2 + e^{iat} \left \{ \frac{\left [ \left ( a+c \right) f -1 \right ]}{2} ^2 \right \}

手动调节括号大小

广义上从大到小的顺序为:\Bigg、\bigg、\Big、\big 、\left、(

\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )
\Bigg ( \bigg [ \Big \{ \big \langle \left | \| \frac{a}{b} \| \right | \big \rangle \Big \} \bigg ] \Bigg )

特殊定界符

Variable-sized Delimiters

特殊定界符 LaTeX 特殊定界符 LaTeX
\uparrow \uparrow \Uparrow \Uparrow
\downarrow \downarrow \Downarrow \Downarrow
\updownarrow \updownarrow \Updownarrow \Updownarrow
\vert \vert \lvert \rvert \Vert \Vert \lVert \rVert
\langle \langle \rangle \rangle
\lceil \lceil \rceil \rceil

根式、方根

平方根以及平方根的嵌套非常简单,使用\sqrt{ }函数即可:

\sqrt{x} \qquad \sqrt{x^{2}-\sqrt{y}}
\sqrt{x} \qquad \sqrt{x^{2}-\sqrt{y}}

n次方根的话只要改为\sqrt[n]{ }即可:

\sqrt[3]{2}
\sqrt[3]{2}

某些特殊情况可能会使用到的方根表达形式:

\surd[x^2+y^2]
\surd[x^2+y^2]

各种箭头

Variable Arrows

箭头符号 LaTeX 箭头符号 LaTeX
\downarrow \downarrow \uparrow \uparrow
\leftarrow \leftarrow \rightarrow \rightarrow
\nwarrow \nwarrow \searrow \searrow
\nearrow \nearrow \swarrow \swarrow
\updownarrow \updownarrow \leftrightarrow \leftrightarrow
\longleftarrow \longleftarrow \longrightarrow \longrightarrow
\longleftrightarrow \longleftrightarrow
\hookleftarrow \hookleftarrow \hookrightarrow \hookrightarrow
\circlearrowleft \circlearrowleft \circlearrowright \circlearrowright
\rightleftharpoons \rightleftharpoons \leftrightharpoons \leftrightharpoons
\Rrightarrow \Rrightarrow \rightrightarrows \rightrightarrows

矩阵、行列式、范数、方阵

LaTeX中矩阵的输入主要由matrix函数实现

\begin{matrix} x & y \\ z & v \end{matrix}
\begin{matrix} x & y \\ z & v \end{matrix}

行列式由vmatrix函数实现

\begin{vmatrix} x & y \\ z & v \end{vmatrix}
\begin{vmatrix} x & y \\ z & v \end{vmatrix}

范数式由Vmatrix函数实现

\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}
\begin{Vmatrix} x & y \\ z & v \end{Vmatrix}

其他方阵或矩阵如下:

\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix}
\begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \end{bmatrix}
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}
\begin{Bmatrix} x & y \\ z & v \end{Bmatrix}
\begin{pmatrix} x & y \\ z & v \end{pmatrix}
\begin{pmatrix} x & y \\ z & v \end{pmatrix}

多行等式

多行等式主要由array函数实现

  • 等式推导
\begin{array}{lcl} f(x) & = & (m+n)^2 \\ & = & m^2+2mn+n^2 \\ \end{array}
\begin{array}{lcl} f(x) & = & (m+n)^2 \\ & = & m^2+2mn+n^2 \\ \end{array}
  • 多行等式左对齐
\begin{array}{lcl} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array}{lcl}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}
  • 多行等式两侧对齐
\begin{array}{lcr} z & = & a \\ f(x,y,z) & = & x + y + z \end{array}
\begin{array}{lcr}
z & = & a \\
f(x,y,z) & = & x + y + z
\end{array}

方程组、数组

使用cases函数可以生成方程组或条件函数

\begin{cases} 3x + 5y + z \\ 7x- 2y + 4z \\ -6x + 3y + 2z \end{cases}
\begin{cases} 3x + 5y + z \\ 7x- 2y + 4z \\ -6x + 3y + 2z \end{cases}

注意,公式内需要输入文字时使用\textrm函数

f(n) = \begin{cases} n/2, & \textrm{if n is even} \\ 3n+1, & \textrm{if n is odd} \end{cases}
f(n) = \begin{cases}
n/2, & \textrm{if n is even} \\
3n+1, & \textrm{if n is odd}
\end{cases}

array函数也能生成方程组或者条件函数等

[p(x)]=\left\{ \begin{array}{ll} 1 & \textrm{p(x) is true} \\ 0 & \textrm{p(x) is false} \end{array} \right.
[p(x)]=\left\{
\begin{array}{ll}
1 & \textrm{p(x) is true} \\
0 & \textrm{p(x) is false}
\end{array}
\right.

其他情况:

\begin{array}{|c|c||c|} a & b & S \\ 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}
\begin{array}{|c|c||c|} a & b & S \\
0&0&1\\
0&1&1\\
1&0&1\\
1&1&0\\
\end{array}

二项式

一般大小

\dbinom{n}{r}=\binom{n}{n-r}=C^n_r=C^n_{n-r}
\dbinom{n}{r}=\binom{n}{n-r}=C^n_r=C^n_{n-r}

较小

\tbinom{n}{r}=\tbinom{n}{n-r}=C^n_r=C^n_{n-r}
\tbinom{n}{r}=\tbinom{n}{n-r}=C^n_r=C^n_{n-r}

较大

\binom{n}{r}=\dbinom{n}{n-r}=C^n_r=C^n_{n-r}
\binom{n}{r}=\dbinom{n}{n-r}=C^n_r=C^n_{n-r}

本站mathjax存在的一些bug

不支持 \bm

9 个赞

感谢!我直接给打印下来贴桌子上

还没写完,等我晚上继续写完再

太细了!太棒了!
(^▽^)/★