LaTeX | 常用符号与表达速查

注:本文为 “ LaTeX 符号” 相关文章合辑。

未全部整理校对去重,请按需索引使用。

如有内容异常,请看原文。

文中显示为 KaTeX…… 的,要么是待校的,要么是 CSDN 目前不支持的,要么是需要特定宏包支持的。


LaTeX 常用符号与表达

一、公式插入方式

语法 描述
$数学公式$ 行中公式单 $ 包裹
$$数学公式$$ 独立公式双 $ 包裹,此处示例受表格所限不独立居中

二、基础符号

(一)加帽子符号

语法 效果 描述
\^{Z} Z ˆ \text{\^{Z}} Zˆ 在正文中为字母 Z 添加帽子符号
\hat{Z} Z ^ \hat{Z} Z^ 在公式中为字母 Z 添加帽子符号

(二)加横线和波浪线

语法 效果 描述
\overline{X} X ‾ \overline{X} X 在字母或表达式上方添加横线
\widetilde{X} X ~ \widetilde{X} X 在字母或表达式上方添加波浪线
\dot{X} X ˙ \dot{X} X˙ 在字母上方添加一个点,表示导数等
\ddot{X} X ¨ \ddot{X} X¨ 在字母上方添加两个点,表示二阶导数等

三、特殊符号

(一)声调

语法 效果 描述
\bar{x} x ˉ \bar{x} xˉ 在字母上方添加横线
\acute{\eta} η ˊ \acute{\eta} ηˊ 在字母上方添加锐音符号
\check{\alpha} α ˇ \check{\alpha} αˇ 在字母上方添加检查符号
\grave{\eta} η ˋ \grave{\eta} ηˋ 在字母上方添加重音符号
\breve{a} a ˘ \breve{a} a˘ 在字母上方添加短音符号
\ddot{y} y ¨ \ddot{y} y¨ 在字母上方添加两个点
\dot{x} x ˙ \dot{x} x˙ 在字母上方添加一个点
\hat{\alpha} α ^ \hat{\alpha} α^ 在字母上方添加帽子
\tilde{\iota} ι ~ \tilde{\iota} ι~ 在字母上方添加波浪线

(二)函数

语法 效果 描述
\sin\theta sin ⁡ θ \sin\theta sinθ 正弦函数
\cos\theta cos ⁡ θ \cos\theta cosθ 余弦函数
\tan\theta tan ⁡ θ \tan\theta tanθ 正切函数
\arcsin\frac{L}{r} arcsin ⁡ L r \arcsin\frac{L}{r} arcsinrL 反正弦函数
\arccos\frac{T}{r} arccos ⁡ T r \arccos\frac{T}{r} arccosrT 反余弦函数
\arctan\frac{L}{T} arctan ⁡ L T \arctan\frac{L}{T} arctanTL 反正切函数
\sinh g sinh ⁡ g \sinh g sinhg 双曲正弦函数
\cosh h cosh ⁡ h \cosh h coshh 双曲余弦函数
\tanh i tanh ⁡ i \tanh i tanhi 双曲正切函数
\operatorname{sh}j sh ⁡ j \operatorname{sh}j shj 双曲正弦函数(另一种表示)
\operatorname{argsh}k argsh ⁡ k \operatorname{argsh}k argshk 双曲正弦的反函数
\operatorname{ch}h ch ⁡ h \operatorname{ch}h chh 双曲余弦函数(另一种表示)
\operatorname{argch}l argch ⁡ l \operatorname{argch}l argchl 双曲余弦的反函数
\operatorname{th}i th ⁡ i \operatorname{th}i thi 双曲正切函数(另一种表示)
\operatorname{argth}m argth ⁡ m \operatorname{argth}m argthm 双曲正切的反函数

(三)同余

语法 效果 描述
\pmod{m} ( m o d m ) \pmod{m} (modm) 表示模 m 的同余关系
a \bmod b a   m o d   b a \bmod b amodb 表示 a 除以 b 的余数

(四)微分

语法 效果 描述
\nabla ∇ \nabla 梯度算子
\partial x ∂ x \partial x x 偏导数符号
\mathrm{d}x d x \mathrm{d}x dx 微分符号
\dot x x ˙ \dot x x˙ 一阶导数符号
\ddot y y ¨ \ddot y y¨ 二阶导数符号

(五)集合

语法 效果 描述
\forall ∀ \forall 表示“对所有”
\exists ∃ \exists 表示“存在”
\empty ∅ \empty 空集
\emptyset ∅ \emptyset 空集
\varnothing ∅ \varnothing 空集
\in ∈ \in 属于
\ni ∋ \ni 包含
\not\in ∉ \not\in 不属于
\notin ∉ \notin / 不属于
\subset ⊂ \subset 真子集
\subseteq ⊆ \subseteq 子集
\supset ⊃ \supset 真超集
\supseteq ⊇ \supseteq 超集
\cap ∩ \cap 交集
\bigcap ⋂ \bigcap 多个集合的交集
\cup ∪ \cup 并集
\bigcup ⋃ \bigcup 多个集合的并集
\biguplus ⨄ \biguplus 多个集合的不相交并集
\sqsubset ⊏ \sqsubset 平方真子集
\sqsubseteq ⊑ \sqsubseteq 平方子集
\sqsupset ⊐ \sqsupset 平方真超集
\sqsupseteq ⊒ \sqsupseteq 平方超集
\sqcap ⊓ \sqcap 平方交集
\sqcup ⊔ \sqcup 平方并集
\bigsqcup ⨆ \bigsqcup 多个集合的平方并集

(六)逻辑

语法 效果 描述
\land ∧ \land 逻辑与
\wedge ∧ \wedge 逻辑与(另一种表示)
\bigwedge ⋀ \bigwedge 多个逻辑与
\bar{q} \to p q ˉ → p \bar{q} \to p qˉp 逻辑非后接逻辑蕴含
\lor ∨ \lor 逻辑或
\vee ∨ \vee 逻辑或(另一种表示)
\bigvee ⋁ \bigvee 多个逻辑或
\lnot ¬ \lnot ¬ 逻辑非
\neg q ¬ q \neg q ¬q 逻辑非(另一种表示)
\setminus ∖ \setminus 集合差
\smallsetminus ∖ \smallsetminus 集合差(另一种表示)

(七)根号

语法 效果 描述
\sqrt{3} 3 \sqrt{3} 3 平方根
\sqrt[n]{3} 3 n \sqrt[n]{3} n3 n 次方根

(八)关系符号

语法 效果 描述
\Delta ABC\sim\Delta XYZ Δ A B C ∼ Δ X Y Z \Delta ABC\sim\Delta XYZ ΔABCΔXYZ 表示三角形相似
\sqrt{3}\approx1.732050808\ldots 3 ≈ 1.732050808 … \sqrt{3}\approx1.732050808\ldots 3 1.732050808 表示近似等于
\simeq ≃ \simeq 表示近似等于
\cong ≅ \cong 表示全等
\dot= = ˙ \dot= =˙ 表示点等于
\ggg ⋙ \ggg 表示远大于
\gg ≫ \gg 表示大于等于
> > > > 表示大于
\ge ≥ \ge 表示大于等于
\geqq ≧ \geqq 表示大于等于
= = = = 表示等于
\leq ≤ \leq 表示小于等于
\leqq ≦ \leqq 表示小于等于
< < < < 表示小于
\ll ≪ \ll 表示小于等于
\lll ⋘ \lll 表示远小于
(x-y)^2\equiv(-x+y)^2\equiv x^2-2xy+y^2 ( x − y ) 2 ≡ ( − x + y ) 2 ≡ x 2 − 2 x y + y 2 (x-y)^2\equiv(-x+y)^2\equiv x^2-2xy+y^2 (xy)2(x+y)2x22xy+y2 表示恒等
x\not\equiv N x ≢ N x\not\equiv N xN 表示不恒等
x\ne A x ≠ A x\ne A x=A 表示不等于
x\neq C x ≠ C x\neq C x=C 表示不等于
t\propto v t ∝ v t\propto v tv 表示正比于
\pm ± \pm ± 表示正负
\mp ∓ \mp 表示负正

(九)几何符号

语法 效果 描述
\Diamond ◊ \Diamond 菱形
\Box □ \Box 正方形
\Delta Δ \Delta Δ 三角形
\angle\Alpha\Beta\Gamma ∠ A B Γ \angle\Alpha\Beta\Gamma ABΓ 表示角名
\sin\frac{\pi}{3}=\sin60^\circ=\frac{\sqrt{3}}{2} sin ⁡ π 3 = sin ⁡ 6 0 ∘ = 3 2 \sin\frac{\pi}{3}=\sin60^\circ=\frac{\sqrt{3}}{2} sin3π=sin60=23 表示角度的正弦值
\perp ⊥ \perp 表示垂直

(十)箭头符号

语法 效果 描述
\leftarrow ← \leftarrow 左箭头
\gets ← \gets 左箭头(另一种表示)
\rightarrow → \rightarrow 右箭头
\to → \to 右箭头(另一种表示)
\leftrightarrow ↔ \leftrightarrow 双向箭头
\longleftarrow ⟵ \longleftarrow 长左箭头
\longrightarrow ⟶ \longrightarrow 长右箭头
\mapsto ↦ \mapsto 映射到
\longmapsto ⟼ \longmapsto 长映射到
\hookrightarrow ↪ \hookrightarrow 带钩的右箭头
\hookleftarrow ↩ \hookleftarrow 带钩的左箭头
\nearrow ↗ \nearrow 向右上箭头
\searrow ↘ \searrow 向右下箭头
\swarrow ↙ \swarrow 向左下箭头
\nwarrow ↖ \nwarrow 向左上箭头
\uparrow ↑ \uparrow 向上箭头
\downarrow ↓ \downarrow 向下箭头
\updownarrow ↕ \updownarrow 向上向下箭头
\rightharpoonup ⇀ \rightharpoonup 右上钩箭头
\rightharpoondown ⇁ \rightharpoondown 右下钩箭头
\leftharpoonup ↼ \leftharpoonup 左上钩箭头
\leftharpoondown ↽ \leftharpoondown 左下钩箭头
\upharpoonleft ↿ \upharpoonleft 向左上钩箭头
\upharpoonright ↾ \upharpoonright 向右上钩箭头
\downharpoonleft ⇃ \downharpoonleft 向左下钩箭头
\downharpoonright ⇂ \downharpoonright 向右下钩箭头
\Leftarrow ⇐ \Leftarrow 左双箭头
\Rightarrow ⇒ \Rightarrow 右双箭头
\Leftrightarrow ⇔ \Leftrightarrow 双向双箭头
\Longleftarrow ⟸ \Longleftarrow 长左双箭头
\Longrightarrow ⟹ \Longrightarrow 长右双箭头
\Longleftrightarrow ⟺ \Longleftrightarrow 长双向双箭头
\Uparrow ⇑ \Uparrow 向上双箭头
\Downarrow ⇓ \Downarrow 向下双箭头
\Updownarrow ⇕ \Updownarrow 向上向下双箭头

(十一)特殊符号

语法 效果 描述
\eth ð \eth ð 丹麦字母 eth
\S § \S § 段落符号
\% % \% % 百分号
\dagger † \dagger 用于表示死亡或结束
\ddagger ‡ \ddagger 双匕首符号
\star ⋆ \star 星号
\ldots … \ldots 横向省略号
\smile ⌣ \smile 上弧符号
\frown ⌢ \frown 下弧符号
\wr ≀ \wr 旋转符号
\oplus ⊕ \oplus 圆环加号
\bigoplus ⨁ \bigoplus 大圆环加号
\otimes ⊗ \otimes 张量积符号
\bigotimes ⨂ \bigotimes 大张量积符号
\times × \times × 乘号
\cdot ⋅ \cdot 点乘符号
\div ÷ \div ÷ 除号
\circ ∘ \circ 圆圈符号
\bullet ∙ \bullet 实心圆点
\bigodot ⨀ \bigodot 大圆圈符号
\boxtimes ⊠ \boxtimes 方框乘号
\boxplus ⊞ \boxplus 方框加号
\triangleleft ◃ \triangleleft 左三角符号
\triangleright ▹ \triangleright 右三角符号
\infty ∞ \infty 无穷大符号
\bot ⊥ \bot 垂直符号
\top ⊤ \top 顶部符号
\vdash ⊢ \vdash 推导符号
\vDash ⊨ \vDash 双推导符号
\Vdash ⊩ \Vdash 强推导符号
\models ⊨ \models 模型符号
\lVert ∥ \lVert 左范数符号
\rVert ∥ \rVert 右范数符号
\imath ı \imath 无点的 i
\hbar ℏ \hbar 约化普朗克常数
\ell ℓ \ell 数学常数 ell
\mho ℧ \mho 电导单位符号
\Finv Ⅎ \Finv 有限群的逆元素
\Re ℜ \Re 实部符号
\Im ℑ \Im 虚部符号
\wp ℘ \wp 魏尔斯特拉斯椭圆函数符号
\complement ∁ \complement 补集符号
\diamondsuit ♢ \diamondsuit 菱形符号(牌面)
\heartsuit ♡ \heartsuit 红心符号(牌面)
\clubsuit ♣ \clubsuit 梅花符号(牌面)
\spadesuit ♠ \spadesuit 黑桃符号(牌面)
\Game ⅁ \Game 博弈符号
\flat ♭ \flat 降调符号
\natural ♮ \natural 自然符号
\sharp ♯ \sharp 升调符号

四、上标、下标及积分等

(一)上标和下标

功能 语法 效果 描述
上标 a^2 a 2 a^2 a2 表示 a 的平方
下标 a_2 a 2 a_2 a2 表示 a 的第二个元素
组合上标 a^{2+2} a 2 + 2 a^{2+2} a2+2 表示 a 的 2+2 次方
组合下标 a_{i,j} a i , j a_{i,j} ai,j 表示 a 的 i,j 元素
结合上下标 x_2^3 x 2 3 x_2^3 x23 表示 x 的 2 次方的 3 次方
前置上下标 {}_1^2\!X_3^4 1 2  ⁣ X 3 4 {}_1^2\!X_3^4 12X34 表示前置上下标和后置上下标

(二)导数

功能 语法 效果 描述
导数(HTML) x' x ′ x' x 表示 x 的一阶导数
导数(PNG) x^\prime x ′ x^\prime x 表示 x 的一阶导数
导数点 \dot{x} x ˙ \dot{x} x˙ 表示 x 的一阶导数
\ddot{y} y ¨ \ddot{y} y¨ 表示 y 的二阶导数

(三)向量

语法 效果 描述
\vec{c} c ⃗ \vec{c} c 表示向量 c
\overleftarrow{a b} a b ← \overleftarrow{a b} ab 表示从 a 到 b 的向量
\overrightarrow{c d} c d → \overrightarrow{c d} cd 表示从 c 到 d 的向量
\widehat{e f g} e f g ^ \widehat{e f g} efg 表示 e, f, g 的单位向量
\overset{\frown}{AB} A B ⌢ \overset{\frown}{AB} AB 表示 AB 的弧

(四)上下括号

类型 语法 效果 描述
上括号 \overbrace{1+2+\cdots+100} 1 + 2 + ⋯ + 100 ⏞ \overbrace{1+2+\cdots+100} 1+2++100 在表达式上方添加括号
下括号 \underbrace{a+b+\cdots+z} a + b + ⋯ + z ⏟ \underbrace{a+b+\cdots+z} a+b++z 在表达式下方添加括号

(五)求和与积分

功能 语法 效果 描述
求和 \sum_{k=1}^N k^2 ∑ k = 1 N k 2 \sum_{k=1}^N k^2 k=1Nk2 求和符号
求积 \prod_{i=1}^N x_i ∏ i = 1 N x i \prod_{i=1}^N x_i i=1Nxi 求积符号
上积 \coprod_{i=1}^N x_i ∐ i = 1 N x i \coprod_{i=1}^N x_i i=1Nxi 上积符号
极限 \lim_{n \to \infty}x_n lim ⁡ n → ∞ x n \lim_{n \to \infty}x_n limnxn 极限符号
积分 \int_{-N}^{N} e^x\, dx ∫ − N N e x   d x \int_{-N}^{N} e^x\, dx NNexdx 积分符号
双重积分 \iint_{D}^{W} \, dx\,dy $\iint_{D}^{W} , dx,dy` 双重积分符号
三重积分 \iiint_{E}^{V} \, dx\,dy\,dz ∭ E V   d x   d y   d z \iiint_{E}^{V} \, dx\,dy\,dz EVdxdydz 三重积分符号
四重积分 \iiiint_{F}^{U} \, dx\,dy\,dz\,dt KaTeX parse error: Undefined control sequence: \iiiint at position 1: \̲i̲i̲i̲i̲n̲t̲_{F}^{U} \, dx\… 四重积分符号
闭合曲线积分 \oint_{C} x^3 \, dx + 4y^2\, dy ∮ C x 3   d x + 4 y 2   d y \oint_{C} x^3\, dx + 4y^2\, dy Cx3dx+4y2dy 闭合曲线积分符号

(六)分数

功能 语法 效果 描述
分数 \frac{2}{4}=0.5 2 4 = 0.5 \frac{2}{4}=0.5 42=0.5 表示分数
小型分数 \tfrac{2}{4} = 0.5 2 4 = 0.5 \tfrac{2}{4} = 0.5 42=0.5 小型分数符号
大型分数(嵌套) \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a 2 c + 2 d + 2 4 = a \cfrac{2}{c + \cfrac{2}{d + \cfrac{2}{4}}} = a c+d+4222=a 大型嵌套分数符号
大型分数(不嵌套) \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a 2 4 = 0.5 2 c + 2 d + 2 4 = a \dfrac{2}{4} = 0.5 \qquad \dfrac{2}{c + \dfrac{2}{d + \dfrac{2}{4}}} = a 42=0.5c+d+4222=a 大型分数符号

(七)矩阵

功能 语法 效果 描述
矩阵 \begin{matrix} x & y \\ z & v \\end{matrix} x y z v \begin{matrix} x & y \\ z & v \end{matrix} xzyv 无框矩阵
行列式 \begin{vmatrix} x & y \\ z & v \\end{vmatrix} ∣ x y z v ∣ \begin{vmatrix} x & y \\ z & v \end{vmatrix} xzyv 矩阵的行列式
矩阵范数 \begin{Vmatrix} x & y \\ z & v \\end{Vmatrix} ∥ x y z v ∥ \begin{Vmatrix} x & y \\ z & v \end{Vmatrix} xzyv 矩阵的范数
矩阵框 \begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0 \\end{bmatrix} [ 0 ⋯ 0 ⋮ ⋱ ⋮ 0 ⋯ 0 ] \begin{bmatrix} 0 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 0\end{bmatrix} 0000 矩阵的方框表示
矩阵大括号 \begin{Bmatrix} x & y \\ z & v \\end{Bmatrix} { x y z v } \begin{Bmatrix} x & y \\ z & v \end{Bmatrix} { xzyv} 矩阵的大括号表示
矩阵小括号 \begin{pmatrix} x & y \\ z & v \\end{pmatrix} ( x y z v ) \begin{pmatrix} x & y \\ z & v \end{pmatrix} (xzyv) 矩阵的小括号表示
小矩阵 \bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) ( a b c d ) \bigl( \begin{smallmatrix} a&b\\ c&d \end{smallmatrix} \bigr) (acbd) 小型矩阵符号

(八)条件定义

语法 效果 描述
f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases} f ( n ) = { n / 2 , if  n  is even 3 n + 1 , if  n  is odd f(n) = \begin{cases} n/2, & \text{if }n\text{ is even} \\ 3n+1, & \text{if }n\text{ is odd} \end{cases} f(n)={ n/2,3n+1,if n is evenif n is odd 条件函数定义

(九)多行等式

语法 效果 描述
\begin{align} f(x) & = (m+n)^2 \\ & = m^2+2mn+n^2 \\ \end{align} KaTeX parse error: {align} can be used only in display mode. 多行等式对齐
\begin{alignat}{2} f(x) & = (m-n)^2 \\ f(x) & = (-m+n)^2 \\ & = m^2-2mn+n^2 \\ \end{alignat} KaTeX parse error: {alignat} can be used only in display mode. 多行等式对齐(指定列数)

(十)方程组

语法 效果 描述
\begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases} { 3 x + 5 y + z 7 x − 2 y + 4 z − 6 x + 3 y + 2 z \begin{cases} 3x + 5y + z \\ 7x - 2y + 4z \\ -6x + 3y + 2z \end{cases} 3x+5y+z7x2y+4z6x+3y+2z 方程组符号

(十一)数组

语法 效果 描述
`\begin{array}{ c c

五、字体

(一)希腊字母

类型 语法 效果 描述
大写希腊字母 \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta A B Γ Δ E Z H Θ \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta ABΓΔEZHΘ 大写希腊字母
\Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi I K Λ M N Ξ O Π \Iota \Kappa \Lambda \Mu \Nu \Xi \Omicron \Pi IKΛMNΞOΠ 大写希腊字母
\Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega P Σ T Υ Φ X Ψ Ω \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega PΣTΥΦXΨΩ 大写希腊字母
小写希腊字母 \alpha \beta \gamma \delta \epsilon \zeta \eta \theta α β γ δ ϵ ζ η θ \alpha \beta \gamma \delta \epsilon \zeta \eta \theta αβγδϵζηθ 小写希腊字母
\iota \kappa \lambda \mu \nu \omicron \xi \pi ι κ λ μ ν ο ξ π \iota \kappa \lambda \mu \nu \omicron \xi \pi ικλμνοξπ 小写希腊字母
\rho \sigma \tau \upsilon \phi \chi \psi \omega ρ σ τ υ ϕ χ ψ ω \rho \sigma \tau \upsilon \phi \chi \psi \omega ρστυϕχψω 小写希腊字母
异体字母 \varepsilon \digamma \varkappa \varpi ε ϝ ϰ ϖ \varepsilon \digamma \varkappa \varpi εϝϰϖ 希腊字母的变体
\varrho \varsigma \vartheta \varphi ϱ ς ϑ φ \varrho \varsigma \vartheta \varphi ϱςϑφ 希腊字母的变体

(二)希伯来符号

语法 效果 描述
\aleph \beth \gimel \daleth ℵ ℶ ℷ ℸ \aleph \beth \gimel \daleth ℶℷℸ 希伯来字母

(三)部分字体的简称

语法 描述 显示
\rm 罗马体 S a m p l e \rm{Sample} Sample
\cal 花体 S A M P L E \cal{SAMPLE} SAMPLE
\it 意大利体 S a m p l e \it{Sample} Sample
\Bbb 黑板粗体 S A M P L E \Bbb{SAMPLE} SAMPLE
\bf 粗体 S a m p l e \bf{Sample} Sample
\mit 数学斜体 KaTeX parse error: Undefined control sequence: \mit at position 1: \̲m̲i̲t̲{SAMPLE}
\sf 等线体 S a m p l e \sf{Sample} Sample
\tt 打字机体 S a m p l e \tt{Sample} Sample
\frak 旧德式字体 S a m p l e \frak{Sample} Sample
\scr 手写体 KaTeX parse error: Undefined control sequence: \scr at position 1: \̲s̲c̲r̲{SAMPLE}

(四)所有字体

类型 语法 效果 描述
黑板报粗体 \mathbb{ABCDEFGHI} A B C D E F G H I \mathbb{ABCDEFGHI} ABCDEFGHI 黑板报粗体字母
\mathbb{JKLMNOPQR} J K L M N O P Q R \mathbb{JKLMNOPQR} JKLMNOPQR 黑板报粗体字母
\mathbb{STUVWXYZ} S T U V W X Y Z \mathbb{STUVWXYZ} STUVWXYZ 黑板报粗体字母
粗体 \mathbf{ABCDEFGHI} A B C D E F G H I \mathbf{ABCDEFGHI} ABCDEFGHI 粗体字母
\mathbf{abcdefghijklm} a b c d e f g h i j k l m \mathbf{abcdefghijklm} abcdefghijklm 粗体字母
\mathbf{0123456789} 0123456789 \mathbf{0123456789} 0123456789 粗体数字
斜体 \mathit{0123456789} 0123456789 \mathit{0123456789} 0123456789 斜体数字
\mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} A B Γ Δ E Z H Θ \mathit{\Alpha\Beta\Gamma\Delta\Epsilon\Zeta\Eta\Theta} ABΓΔEZHΘ 斜体希腊字母
罗马体 \mathrm{ABCDEFGHI} A B C D E F G H I \mathrm{ABCDEFGHI} ABCDEFGHI 罗马体字母
\mathrm{abcdefghijklm} a b c d e f g h i j k l m \mathrm{abcdefghijklm} abcdefghijklm 罗马体字母
\mathrm{0123456789} 0123456789 \mathrm{0123456789} 0123456789 罗马体数字
无衬线体 \mathsf{ABCDEFGHI} A B C D E F G H I \mathsf{ABCDEFGHI} ABCDEFGHI 无衬线体字母
\mathsf{abcdefghijklm} a b c d e f g h i j k l m \mathsf{abcdefghijklm} abcdefghijklm 无衬线体字母
\mathsf{0123456789} 0123456789 \mathsf{0123456789} 0123456789 无衬线体数字
手写体/花体 \mathcal{ABCDEFGHI} A B C D E F G H I \mathcal{ABCDEFGHI} ABCDEFGHI 手写体/花体字母
\mathcal{JKLMNOPQR} J K L M N O P Q R \mathcal{JKLMNOPQR} JKLMNOPQR 手写体/花体字母
\mathcal{STUVWXYZ} S T U V W X Y Z \mathcal{STUVWXYZ} STUVWXYZ 手写体/花体字母
Fraktur体 \mathfrak{ABCDEFGHI} A B C D E F G H I \mathfrak{ABCDEFGHI} ABCDEFGHI Fraktur体字母
\mathfrak{abcdefghijklm} a b c d e f g h i j k l m \mathfrak{abcdefghijklm} abcdefghijklm Fraktur体字母
\mathfrak{0123456789} 0123456789 \mathfrak{0123456789} 0123456789 Fraktur体数字
小型手写体 {\scriptstyle\text{abcdefghijklm}} abcdefghijklm {\scriptstyle\text{abcdefghijklm}} abcdefghijklm 小型手写体字母

(五)混合字体

特征 语法 效果 描述
斜体字符 x y z x y z xyz xyz 斜体字符
非斜体字符 \text{x y z} x y z \text{x y z} x y z 非斜体字符
混合斜体 \text{if }n\text{ is even} if  n  is even \text{if }n\text{ is even} if n is even 混合斜体字符
混合斜体 \text{if}~n\ \text{is even} if  n  is even \text{if}~n\ \text{is even} if n is even 混合斜体字符(带空格)

六、注释文本

描述 语法 效果
注释文本 \text {文字} 文字 \text {文字} 文字
公式中注释 f(n)= \begin{cases}n/2, & \text {if $n$ is even} \\ 3n+1, &\text{if $n$ is odd}\end{cases} f ( n ) = { n / 2 , if  n  is even 3 n + 1 , if  n  is odd f(n)= \begin{cases}n/2, & \text {if $n$ is even} \\ 3n + 1, & \text{if $n$ is odd}\end{cases} f(n)={ n/2,3n+1,if n is evenif n is odd

七、括号

功能 语法 效果 描述
短括号 \frac{1}{2} ( 1 2 ) (\frac{1}{2}) (21) 普通大小的圆括号
长括号 \left(\frac{1}{2} \right) ( 1 2 ) \left(\frac{1}{2}\right) (21) 自动调整大小的圆括号
圆括号 \left( \frac{a}{b} \right) ( a b ) \left(\frac{a}{b}\right) (ba) 自动调整大小的圆括号
方括号 \left[ \frac{a}{b} \right] [ a b ] \left[\frac{a}{b}\right] [ba] 自动调整大小的方括号
花括号 \left\{ \frac{a}{b} \right\} { a b } \left\{\frac{a}{b}\right\} { ba} 自动调整大小的花括号
角括号 \left \langle \frac{a}{b} \right \rangle ⟨ a b ⟩ \left\langle \frac{a}{b}\right\rangle ba 自动调整大小的角括号
单竖线 `\left \frac{a}{b} \right `
双竖线 \left | \frac{a}{b} \right | ∣ a b ∣ \left| \frac{a}{b} \right| ba 自动调整大小的双竖线
取整函数 \left \lfloor \frac{a}{b} \right \rfloor ⌊ a b ⌋ \left\lfloor \frac{a}{b} \right\rfloor ba 自动调整大小的取整函数符号
取顶函数 \left \lceil \frac{c}{d} \right \rceil ⌈ c d ⌉ \left\lceil \frac{c}{d} \right\rceil dc 自动调整大小的取顶函数符号
斜线与反斜线 \left / \frac{a}{b} \right \backslash / a b \ \left/ \frac{a}{b} \right\backslash /ba\ 自动调整大小的斜线与反斜线
上下箭头 \left \uparrow \frac{a}{b} \right \downarrow ↑ a b ↓ \left\uparrow \frac{a}{b} \right\downarrow ba 自动调整大小的上下箭头
混合括号 \left[ 0,1 \right) [ 0 , 1 ) \left[0,1\right) [0,1) 混合括号
单左括号 \left \{\frac{a}{b} \right.< { a b \left\{\frac{a}{b}\right. { ba 单左括号
单右括号 \left. \frac{a}{b} \right \} a b } \left. \frac{a}{b} \right\} ba} 单右括号

控制括号大小

语法 效果 描述
\big ( ) \big( \big) () 手动设置括号大小
\Big ( ) \Big( \Big) () 手动设置括号大小
\bigg ( ) \bigg( \bigg) () 手动设置括号大小
\Bigg ( ) \Bigg( \Bigg) () 手动设置括号大小

例如:
语法:\Bigg ( \bigg [ \Big \{ \big \langle \left | \left \| \frac{a}{b} \right \| \right | \big \rangle \Big \} \bigg ] \Bigg )
显示为: ( [ { ⟨ ∣ ∥ a b ∥ ∣ ⟩ } ] ) \Bigg ( \bigg [ \Big \{ \big \langle \left | \left \| \frac{a}{b} \right \| \right | \big \rangle \Big \} \bigg ] \Bigg ) ([{ ba }])

八、空格

功能 语法 效果 宽度
2个quad空格 \alpha\qquad\beta α β \alpha \qquad \beta αβ 2 m 2m 2m
quad空格 \alpha\quad\beta α β \alpha \quad \beta αβ m m m
大空格 \alpha\ \beta α   β \alpha \ \beta α β m 3 \frac{m}{3} 3m
中等空格 \alpha\;\beta α    β \alpha \;\beta αβ 2 m 7 \frac{2m}{7} 72m
小空格 \alpha\,\beta α   β \alpha \,\beta αβ m 6 \frac{m}{6} 6m
没有空格 \alpha\beta α β \alpha \beta αβ 0 0 0
紧贴 \alpha\!\beta α  ⁣ β \alpha \!\beta αβ − m 6 -\frac{m}{6} 6m

九、颜色

功能 语法 显示
字体颜色 \color{色调}{表达式} x 2 \color{Blue}{x^2} x2
背景颜色 \pagecolor{色调}{表达式} KaTeX parse error: Undefined control sequence: \pagecolor at position 1: \̲p̲a̲g̲e̲c̲o̲l̲o̲r̲{Gray}{\color{W…

(一)HTML4 与 CSS2 支持的颜色

颜色 描述 效果 颜色 描述 效果
black 黑色 t e x t \color{black}{text} text grey 灰色 t e x t \color{grey}{text} text
silver 银色 t e x t \color{silver}{text} text white 白色 t e x t \color{white}{text} text
maroon 栗色 t e x t \color{maroon}{text} text red 红色 t e x t \color{red}{text} text
yellow 黄色 t e x t \color{yellow}{text} text lime 酸橙色 t e x t \color{lime}{text} text
olive 橄榄色 t e x t \color{olive}{text} text green 绿色 t e x t \color{green}{text} text
teal 水绿色 t e x t \color{teal}{text} text auqa 宝石绿色 t e x t \color{auqa}{text} text
blue 蓝色 t e x t \color{blue}{text} text navy 海军蓝 t e x t \color{navy}{text} text
purple 紫色 t e x t \color{purple}{text} text fuchsia 紫红色 t e x t \color{fuchsia}{text} text

(二)HTML5 与 CSS3 支持的颜色

语法 效果
\color{#rgb}{text} t e x t \color{#00F}{text} text

例如:

  • #000 表示黑色
  • #00F 表示蓝色
  • #0F0 表示绿色
  • #0FF 表示青色
  • #F00 表示红色
  • #F0F 表示洋红色
  • #FF0 表示黄色
  • #FFF 表示白色

(三)其他支持的颜色

语法 效果 描述
\color{Apricot}{\text{Apricot}} Apricot \color{Apricot}{\text{Apricot}} Apricot 橘子色
\color{Bittersweet}{\text{Bittersweet}} Bittersweet \color{Bittersweet}{\text{Bittersweet}} Bittersweet 苦甜色
\color{Black}{\text{Black}} Black \color{Black}{\text{Black}} Black 黑色
\color{Blue}{\text{Blue}} Blue \color{Blue}{\text{Blue}} Blue 蓝色
\color{BlueGreen}{\text{BlueGreen}} BlueGreen \color{BlueGreen}{\text{BlueGreen}} BlueGreen 蓝绿色
\color{BlueViolet}{\text{BlueViolet}} BlueViolet \color{BlueViolet}{\text{BlueViolet}} BlueViolet 蓝紫罗兰色
\color{BrickRed}{\text{BrickRed}} BrickRed \color{BrickRed}{\text{BrickRed}} BrickRed 砖红色
\color{Brown}{\text{Brown}} Brown \color{Brown}{\text{Brown}} Brown 棕色
\color{BurntOrange}{\text{BurntOrange}} BurntOrange \color{BurntOrange}{\text{BurntOrange}} BurntOrange 焦橙色
\color{CadetBlue}{\text{CadetBlue}} CadetBlue \color{CadetBlue}{\text{CadetBlue}} CadetBlue 军校蓝
\color{CarnationPink}{\text{CarnationPink}} CarnationPink \color{CarnationPink}{\text{CarnationPink}} CarnationPink 康乃馨粉色
\color{Cerulean}{\text{Cerulean}} Cerulean \color{Cerulean}{\text{Cerulean}} Cerulean 天青色
\color{CornflowerBlue}{\text{CornflowerBlue}} CornflowerBlue \color{CornflowerBlue}{\text{CornflowerBlue}} CornflowerBlue 矢车菊蓝色
\color{Cyan}{\text{Cyan}} Cyan \color{Cyan}{\text{Cyan}} Cyan 青色
\color{Dandelion}{\text{Dandelion}} Dandelion \color{Dandelion}{\text{Dandelion}} Dandelion 蒲公英黄色
\color{DarkOrchid}{\text{DarkOrchid}} DarkOrchid \color{DarkOrchid}{\text{DarkOrchid}} DarkOrchid 深紫罗兰色
\color{Emerald}{\text{Emerald}} Emerald \color{Emerald}{\text{Emerald}} Emerald 祖母绿
\color{ForestGreen}{\text{ForestGreen}} ForestGreen \color{ForestGreen}{\text{ForestGreen}} ForestGreen 森林绿
\color{Fuchsia}{\text{Fuchsia}} Fuchsia \color{Fuchsia}{\text{Fuchsia}} Fuchsia 紫红色
\color{Goldenrod}{\text{Goldenrod}} Goldenrod \color{Goldenrod}{\text{Goldenrod}} Goldenrod 金菊黄
\color{Gray}{\text{Gray}} Gray \color{Gray}{\text{Gray}} Gray 灰色
\color{Green}{\text{Green}} Green \color{Green}{\text{Green}} Green 绿色
\color{GreenYellow}{\text{GreenYellow}} GreenYellow \color{GreenYellow}{\text{GreenYellow}} GreenYellow 绿黄色
\color{JungleGreen}{\text{JungleGreen}} JungleGreen \color{JungleGreen}{\text{JungleGreen}} JungleGreen 丛林绿
\color{Lavender}{\text{Lavender}} Lavender \color{Lavender}{\text{Lavender}} Lavender 薰衣草色
\color{LimeGreen}{\text{LimeGreen}} LimeGreen \color{LimeGreen}{\text{LimeGreen}} LimeGreen 酸橙绿
\color{Magenta}{\text{Magenta}} Magenta \color{Magenta}{\text{Magenta}} Magenta 品红色
\color{Mahogany}{\text{Mahogany}} Mahogany \color{Mahogany}{\text{Mahogany}} Mahogany 桃花心木色
\color{Maroon}{\text{Maroon}} Maroon \color{Maroon}{\text{Maroon}} Maroon 栗色
\color{Melon}{\text{Melon}} Melon \color{Melon}{\text{Melon}} Melon 蜜瓜色
\color{MidnightBlue}{\text{MidnightBlue}} MidnightBlue \color{MidnightBlue}{\text{MidnightBlue}} MidnightBlue 午夜蓝
\color{Mulberry}{\text{Mulberry}} Mulberry \color{Mulberry}{\text{Mulberry}} Mulberry 莓果色
\color{NavyBlue}{\text{NavyBlue}} NavyBlue \color{NavyBlue}{\text{NavyBlue}} NavyBlue 海军蓝
\color{OliveGreen}{\text{OliveGreen}} OliveGreen \color{OliveGreen}{\text{OliveGreen}} OliveGreen 橄榄绿
\color{Orange}{\text{Orange}} Orange \color{Orange}{\text{Orange}} Orange 橙色
\color{OrangeRed}{\text{OrangeRed}} OrangeRed \color{OrangeRed}{\text{OrangeRed}} OrangeRed 橙红色
\color{Orchid}{\text{Orchid}} Orchid \color{Orchid}{\text{Orchid}} Orchid 兰花紫
\color{Peach}{\text{Peach}} Peach \color{Peach}{\text{Peach}} Peach 桃色
\color{Periwinkle}{\text{Periwinkle}} Periwinkle \color{Periwinkle}{\text{Periwinkle}} Periwinkle 士耳其蓝
\color{PineGreen}{\text{PineGreen}} PineGreen \color{PineGreen}{\text{PineGreen}} PineGreen 松树绿
\color{Plum}{\text{Plum}} Plum \color{Plum}{\text{Plum}} Plum 茄子紫
\color{ProcessBlue}{\text{ProcessBlue}} ProcessBlue \color{ProcessBlue}{\text{ProcessBlue}} ProcessBlue 蓝色处理
\color{Purple}{\text{Purple}} Purple \color{Purple}{\text{Purple}} Purple 紫色
\color{RawSienna}{\text{RawSienna}} RawSienna \color{RawSienna}{\text{RawSienna}} RawSienna 生赭石色
\color{Red}{\text{Red}} Red \color{Red}{\text{Red}} Red 红色
\color{RedOrange}{\text{RedOrange}} RedOrange \color{RedOrange}{\text{RedOrange}} RedOrange 红橙色
\color{RedViolet}{\text{RedViolet}} RedViolet \color{RedViolet}{\text{RedViolet}} RedViolet 红紫罗兰色
\color{Rhodamine}{\text{Rhodamine}} Rhodamine \color{Rhodamine}{\text{Rhodamine}} Rhodamine 罗丹明色
\color{RoyalBlue}{\text{RoyalBlue}} RoyalBlue \color{RoyalBlue}{\text{RoyalBlue}} RoyalBlue 皇家蓝
\color{RoyalPurple}{\text{RoyalPurple}} RoyalPurple \color{RoyalPurple}{\text{RoyalPurple}} RoyalPurple 皇家紫
\color{RubineRed}{\text{RubineRed}} RubineRed \color{RubineRed}{\text{RubineRed}} RubineRed 鲁比红
\color{Salmon}{\text{Salmon}} Salmon \color{Salmon}{\text{Salmon}} Salmon 三文鱼色
\color{SeaGreen}{\text{SeaGreen}} SeaGreen \color{SeaGreen}{\text{SeaGreen}} SeaGreen 海洋绿
\color{Sepia}{\text{Sepia}} Sepia \color{Sepia}{\text{Sepia}} Sepia 赭石色
\color{SkyBlue}{\text{SkyBlue}} SkyBlue \color{SkyBlue}{\text{SkyBlue}} SkyBlue 天空蓝
\color{SpringGreen}{\text{SpringGreen}} SpringGreen \color{SpringGreen}{\text{SpringGreen}} SpringGreen 春季绿
\color{Tan}{\text{Tan}} Tan \color{Tan}{\text{Tan}} Tan 褐色
\color{TealBlue}{\text{TealBlue}} TealBlue \color{TealBlue}{\text{TealBlue}} TealBlue 青蓝色
\color{Thistle}{\text{Thistle}} Thistle \color{Thistle}{\text{Thistle}} Thistle 蓟色
\color{Turquoise}{\text{Turquoise}} Turquoise \color{Turquoise}{\text{Turquoise}} Turquoise 碧绿色
\color{Violet}{\text{Violet}} Violet \color{Violet}{\text{Violet}} Violet 紫罗兰色
\color{VioletRed}{\text{VioletRed}} VioletRed \color{VioletRed}{\text{VioletRed}} VioletRed 紫红色
\color{White}{\text{White}} White \color{White}{\text{White}} White 白色
\color{WildStrawberry}{\text{WildStrawberry}} WildStrawberry \color{WildStrawberry}{\text{WildStrawberry}} WildStrawberry 野生草莓色
\color{Yellow}{\text{Yellow}} Yellow \color{Yellow}{\text{Yellow}} Yellow 黄色
\color{YellowGreen}{\text{YellowGreen}} YellowGreen \color{YellowGreen}{\text{YellowGreen}} YellowGreen 黄绿色
\color{YellowOrange}{\text{YellowOrange}} YellowOrange \color{YellowOrange}{\text{YellowOrange}} YellowOrange 黄橙色

部分颜色 KaTeX 中差异不明显。

维基百科的数学公式颜色语法

{\color{颜色}表达式}

作者实测:在部分浏览器中,上面的语法可能只将表达式的第一个字符着色,\color{颜色}{文字} 的语法才是所有字符全着色。例如:

{\color{Red}abc} 显示 a b c {\color{Red}a}bc abc

\color{Red}{abc} 显示 a b c \color{Red}{abc} abc

*注︰输入时第一个字母必需以大写输入,如 \color{OliveGreen}

例子

  • {\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1}

    x 2 + 2 x − 1 {\color{Blue}x^2}+{\color{Brown}2x} - {\color{OliveGreen}1} x2+2x1

  • x_{\color{Maroon}1,2}=\frac{-b\pm\sqrt{ {\color{Maroon}b^2-4ac}}}{2a}

    x 1 , 2 = − b ± b 2 − 4 a c 2 a x_{\color{Maroon}1,2}=\frac{-b\pm\sqrt{ {\color{Maroon}b^2-4ac}}}{2a} x1,2=2ab±b24ac


via:

猜你喜欢

转载自blog.csdn.net/u013669912/article/details/147005417
今日推荐