1个蒟蒻

· · 个人记录

aTeX 公式大全,超全!

xzz_0611

已于 2024-04-19 18:05:28 修改

阅读量1.1k 收藏 28

点赞数 35 文章标签: KaTeX 版权 这里写目录标题 前言 本文章介绍 声调记号 定界符(括号之类) 定界符大小[ 5 ] ^{[5]} [5]

环境[ 6 ] ^{[6]} [6]

Unicode [ 7 ] \text{Unicode}^{[7]}Unicode [7] 数学字母、符号 U n i c o d e \rm UnicodeUnicode 布局 注解/标记 换行指令 垂直布局 重叠和间距 间隔 提示 逻辑与集合符号 宏定义 运算符 巨型运算符[ 14 ] ^{[14]} [14]

二元运算符 分数和二项式 数学运算符 开根 关系指令 箭头 箭头扩展[ 16 ] ^{[16]} [16]

样式,颜色,大小和字体 类的分配[ 17 ] ^{[17]} [17]

颜色 字体 大小 样式 符号和标点 单位 前言 这张表应该涵盖了纯 KaTeX \KaTeXK A T E ​ X 所有的功能。当然,LaTeX \LaTeXL A T E ​ X 公式大全亦可作为部分参考。下面是搬运部分。

本文章介绍 这是一张由 KaTeX \KaTeXK A T E ​ X 支持的 TeX \TeXT E ​ X 公式清单。他按照逻辑顺序分类。

这有一个相似的按照字典序排列的 支持表。那张表格同样写出了不受支持的公式。

声调记号 第一列 第二列 第三列 a ′ a'a ′ a' a ~ \tilde{a} a ~ \tilde{a} g ˚ \mathring{g} g ˚ ​ \mathring{g} a ′ ′ a''a ′′ a'' a c ~ \widetilde{ac} ac \widetilde{ac} A B ⏠ \overgroup{AB} AB \overgroup{AB} a ′ a^{\prime}a ′ a^{\prime} A B ~ \utilde{AB} AB ​ \utilde{AB} A B ⏡ \undergroup{AB} AB ​ \undergroup{AB} a ˊ \acute{a} a ˊ \acute{a} F ⃗ \vec{F} F \vec{F} A B ⇒ \Overrightarrow{AB} AB \Overrightarrow{AB} y ˉ \bar{y} y ˉ ​ \bar{y} A B ← \overleftarrow{AB} AB \overleftarrow{AB} A B → \overrightarrow{AB} AB \overrightarrow{AB} a ˘ \breve{a} a ˘ \breve{a} A B ← \underleftarrow{AB} AB ​ \underleftarrow{AB} A B → \underrightarrow{AB} AB ​ \underrightarrow{AB} a ˇ \check{a} a ˇ \check{a} a c ↼ \overleftharpoon{ac} ac \overleftharpoon{ac} a c ⇀ \overrightharpoon{ac} ac \overrightharpoon{ac} a ˙ \dot{a} a ˙ \dot{a} A B ↔ \overleftrightarrow{AB} AB \overleftrightarrow{AB} A B ⏞ \overbrace{AB} AB \overbrace{AB} a ¨ \ddot{a} a ¨ \ddot{a} A B ↔ \underleftrightarrow{AB} AB ​ \underleftrightarrow{AB} A B ⏟ \underbrace{AB} AB ​ \underbrace{AB} a ˋ \grave{a} a ˋ \grave{a} A B ‾ \overline{AB} AB \overline{AB} A B undefined \overlinesegment{AB} AB \overlinesegment{AB} θ ^ \hat{\theta} θ ^ \hat{\theta} A B ‾ \underline{AB} AB ​ \underline{AB} A B undefined \underlinesegment{AB} AB ​ \underlinesegment{AB} a c ^ \widehat{ac} ac \widehat{ac} a c ˇ \widecheck{ac} ac \widecheck{ac}
另外,还有一些上下音标适合用在\text{}环境下。[ 1 ] ^{[1]} [1]

第一列 第二列 第三列 第四列 a ˊ \text{\'{a}} a ˊ \'{a} a ˜ \text{~{a}} a ˜ ~{a} a ˙ \text{.{a}} a ˙ .{a} a ˝ \text{\H{a}} a ˝ \H{a} a ˋ \text{`{a}} a ˋ [ 2 ] ^{[2]} [2] a ˉ \text{\={a}} a ˉ \={a} a ¨ \text{\"{a}} a ¨ \"{a} a ˇ \v{a} a ˇ \v{a} a ˆ \text{\^{a}} a ˆ \^{a} a ˘ \text{\u{a}} a ˘ \u{a} a ˚ \text{\r{a}} a ˚ \r{a} [ 1 ] : [1]:[1]: 这类特殊的音标需要用在文字环境下,即 \text{} 里面,比如 \text{\'{a}}。

[ 2 ] : [2]:[2]: 由于会和 M a r k d o w n \rm MarkdownMarkdown 的代码块冲突,这里说明一下,这个音标的代码其实是 +波浪线对应按键+{}。

另请参阅 字母 章节。

定界符(括号之类) 第一列 第二列 第三列 第四列 第五列 ( ) ()() () ( ) \lparen\rparen() \lparen\rparen ⌈ ⌉ ⌈ ⌉⌈⌉ ⌈ ⌉ ⌈ ⌉ \lceil \rceil⌈⌉ \lceil rceil ↑ \uparrow↑ \uparrow [ ] [ ][] [ ] [ ] \lbrack\rbrack[]\lbrack\rbrack ⌊ ⌋ ⌊ ⌋⌊⌋ ⌊ ⌋ ⌊ ⌋ \lfloor\rfloor⌊⌋ \lfloor\rfloor ↓ \downarrow↓ \downarrow { } { }{} { } { } \lbrace\rbrace{} \lbrace\rbrace ⎰ ⎱ ⎰⎱⎰⎱ ⎰⎱ ⎰ ⎱ \lmoustache\rmoustache⎰⎱ \lmoustache\rmoustache ↕ \updownarrow↕ \updownarrow ⟨ ⟩ ⟨ ⟩⟨⟩ ⟨ ⟩ ⟨ ⟩ \langle\rangle⟨⟩\langle\rangle ⟮ ⟯ ⟮ ⟯⟮⟯ ⟮ ⟯ ⟮ ⟯ \lgroup\rgroup⟮⟯ \lgroup\rgroup ⇑ \Uparrow⇑ \Uparrow [ 3 ] ^{[3]} [3] | ∣ \vert∣ \vert ┌ ┐ ┌ ┐┌┐ ┌ ┐ ⌜ ⌝ \ulcorner\urcorner┌┐ \ulcorner\urcorner ⇓ \Downarrow⇓ \Downarrow ∣ |∣ | ∥ \Vert∥ \Vert └ ┘ └ ┘└┘ └ ┘ ⌞ ⌟ \llcorner\lrcorner└┘ \llcorner\lrcorner ⇕ \Updownarrow⇕ \Updownarrow ∣ ∣ \lvert\rvert∣∣\lvert\rvert ∥ ∥ \lVert\rVert∥∥ \lVert\rVert \left.[ 4 ] ^{[4]} [4] \right. \ \backslash\ \backslash ⟨ ⟩ \lang\rang⟨⟩ \lang\rang < > \lt \gt<>\lt \gt ⟦ ⟧ ⟦ ⟧[[]]⟦ ⟧ ⟦ ⟧ \llbracket\rrbracket[[]] \llbracket\rrbracket ⦃ ⦄ \lBrace \rBrace{[]} \lBrace \rBrace [ 3 ] : [3]:[3]: 由于 M a r k d o w n \rm MarkdownMarkdown 的制表与|有冲突,因此无法在表格中显示 ∣ |∣。

[ 4 ] : [4]:[4]: \left 和 \right 后面直接加括号,能显示括号。(人类迷惑行为)

定界符大小[ 5 ] ^{[5]} [5]

( A B ) \left(\LARGE{AB}\right)(AB) \left(\LARGE{AB}\right)

( ( ( ( ( ( \big( \Big( \bigg( \Bigg(((((( ( \big( \Big( \bigg( \Bigg(

[ 5 ] : [5]:[5]: 这里定界符主要指括号。KaTeX \KaTeXK A T E ​ X 提供了一些指令来调整括号的大小。另外,这里 \left,\right 指令是自动调整括号大小。

第一列 第二列 第三列 第四列 第五列 \left \big \bigl \bigm \bigr \middle \Big \Bigl \Bigm \Bigr \right \bigg \biggl \biggm \biggr \Bigg \Biggl \Biggm \Biggr 环境[ 6 ] ^{[6]} [6]

第一列 第二列 第三列 第四列 a b c d acbd 𝑎 𝑏 𝑐 𝑑 a c ​

b d ​ \ b e g i n { m a t r i x } a & b \ \ c & d \ e n d { m a t r i x } ∖begin{matrix}a&b∖∖c&d∖end{matrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐 & 𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

\begin{matrix} a&b\ c&d \end{matrix} ​ a b c d acbd 𝑎 𝑏 𝑐 𝑑 a c ​

b d ​ \ b e g i n { a r r a y } { c c } a & b \ \ c & d \ e n d { a r r a y } ∖begin{array}{cc}a&b∖∖c&d∖end{array} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑎 𝑟 𝑟 𝑎 𝑦 } { 𝑐 𝑐 } 𝑎 & 𝑏 ∖ ∖ 𝑐 & 𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑎 𝑟 𝑟 𝑎 𝑦 } ​

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

( a b c d ) (acbd) ( 𝑎 𝑏 𝑐 𝑑 ) ( a c ​

b d ​ ) \ b e g i n { p m a t r i x } a & b \ \ c & d \ e n d { p m a t r i x } ∖begin{pmatrix}a&b∖∖c&d∖end{pmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑝 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐 & 𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑝 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

\begin{pmatrix} a&b\ c&d \end{pmatrix} ​ [ a b c d ] [acbd] [ 𝑎 𝑏 𝑐 𝑑 ] [ a c ​

b d ​ ] \ b e g i n { b m a t r i x } a & b \ \ c & d \ e n d { b m a t r i x } ∖begin{bmatrix}a&b∖∖c&d∖end{bmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑏 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐 & 𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑏 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

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

∣ a b c d ∣ ∣∣∣acbd∣∣∣ | 𝑎 𝑏 𝑐 𝑑 | ​

a c ​

b d ​

​ \ b e g i n { v m a t r i x } a & b \ \ c d \ e n d { v m a t r i x } ∖begin{vmatrix}a&b∖∖c d∖end{vmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑣 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐

𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑣 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

\begin{vmatrix} a&b\ c d \end{vmatrix} ​ ∥ a b c d ∥ ∥∥∥acbd∥∥∥ ‖ 𝑎 𝑏 𝑐 𝑑 ‖ ​

a c ​

b d ​

​ \ b e g i n { V m a t r i x } a & b \ \ c d \ e n d { V m a t r i x } ∖begin{Vmatrix}a&b∖∖c d∖end{Vmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑉 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐

𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑉 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

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

{ a b c d } {acbd} { 𝑎 𝑏 𝑐 𝑑 } { a c ​

b d ​ } \ b e g i n { B m a t r i x } a & b \ \ c d \ e n d { B m a t r i x } ∖begin{Bmatrix}a&b∖∖c d∖end{Bmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝐵 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐

𝑑 ∖ 𝑒 𝑛 𝑑 { 𝐵 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

\begin{Bmatrix} a&b\ c d \end{Bmatrix} ​ a b c d e f g h i \def\arraystretch{1.5} adgbehcfi 𝑎 𝑏 𝑐 𝑑 𝑒 𝑓 𝑔 ℎ 𝑖 a d g ​

b e h ​

c f i ​

​ \ d e f \ a r r a y s t r e t c h { 1.5 } \ b e g i n { a r r a y } { c : c : c } a & b & c \ \ \ h l i n e d & e & f \ \ \ h d a s h l i n e g & h & i \ e n d { a r r a y } ∖def∖arraystretch{1.5}∖begin{array}{c:c:c}a&b&c∖∖∖hlined&e&f∖∖∖hdashlineg&h&i∖end{array} ∖ 𝑑 𝑒 𝑓 ∖ 𝑎 𝑟 𝑟 𝑎 𝑦 𝑠 𝑡 𝑟 𝑒 𝑡 𝑐 ℎ { 1.5 } ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑎 𝑟 𝑟 𝑎 𝑦 } { 𝑐 : 𝑐 : 𝑐 } 𝑎 & 𝑏 & 𝑐 ∖ ∖ ∖ ℎ 𝑙 𝑖 𝑛 𝑒 𝑑 & 𝑒 & 𝑓 ∖ ∖ ∖ ℎ 𝑑 𝑎 𝑠 ℎ 𝑙 𝑖 𝑛 𝑒 𝑔 & ℎ & 𝑖 ∖ 𝑒 𝑛 𝑑 { 𝑎 𝑟 𝑟 𝑎 𝑦 } ​

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

a = b + c d + e = f ad+e=b+c=f 𝑎

𝑏

=b+c =f ​ \ { a l i g n e d } a & = b + c \ \ d + e & = f \ e n d { a l i g n e d } ∖{aligned}a&=b+c∖∖d+e&=f∖end{aligned} ∖ { 𝑎 𝑙 𝑖 𝑔 𝑛 𝑒 𝑑 } 𝑎 &

𝑏

{aligned} a&=b+c\ d+e&=f \end{aligned} ​ 10 x + 3 y = 2 3 x + 13 y = 4 103x+x+313y=2y=4 10 𝑥

x+ x+ ​

3 13 ​

y=2 y=4 ​ \ b e g i n { a l i g n e d a t } { 2 } 10 & x + & 3 & y = 2 \ \ 3 & x + & 13 & y = 4 \ e n d { a l i g n e d a t } ∖begin{alignedat}{2}10&x+&3&y=2∖∖3&x+&13&y=4∖end{alignedat} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑎 𝑙 𝑖 𝑔 𝑛 𝑒 𝑑 𝑎 𝑡 } { 2 } 10 & 𝑥

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

a = b e = b + c a=be=b+c 𝑎

𝑏 𝑒

𝑏

\begin{gathered} a=b\ e=b+c \end{gathered} ​ x = { a if b c if d x = {acif bif d { 𝑎 if 𝑏 𝑐 if 𝑑 x={ a c ​

if b if d ​ x = \ b e g i n { c a s e s } a & \ t e x t { i f } b \ \ c & \ t e x t { i f } d \ e n d { c a s e s } x=∖begin{cases}a&∖text{if}b∖∖c&∖text{if}d∖end{cases} 𝑥

∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑐 𝑎 𝑠 𝑒 𝑠 } 𝑎 & ∖ 𝑡 𝑒 𝑥 𝑡 { 𝑖 𝑓 } 𝑏 ∖ ∖ 𝑐 & ∖ 𝑡 𝑒 𝑥 𝑡 { 𝑖 𝑓 } 𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑐 𝑎 𝑠 𝑒 𝑠 } ​

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

a b c d acdb 𝑎 𝑏 𝑐 𝑑 a cd ​

b \ b e g i n { s m a l l m a t r i x } a & b \ \ c d \ e n d { s m a l l m a t r i x } ∖begin{smallmatrix}a&b∖∖c d∖end{smallmatrix} ∖ 𝑏 𝑒 𝑔 𝑖 𝑛 { 𝑠 𝑚 𝑎 𝑙 𝑙 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } 𝑎 & 𝑏 ∖ ∖ 𝑐

𝑑 ∖ 𝑒 𝑛 𝑑 { 𝑠 𝑚 𝑎 𝑙 𝑙 𝑚 𝑎 𝑡 𝑟 𝑖 𝑥 } ​

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

[ 6 ] : [6]:[6]: 因为相关原因,在表格里换行不是很方便,因此这里直接嵌入的是 KaTeX \KaTeXK A T E ​ X。

Unicode [ 7 ] \text{Unicode}^{[7]}Unicode [7] 数学字母、符号 字段 支持的字符 字段 支持的字符 粗体 A-Z,a-z,0-9 \textbf{A-Z,a-z,0-9}A-Z,a-z,0-9 双线体 A − Z , k \Bbb{A-Z,k}A−Z,k 意大利斜体 A-Z,a-z \textit{A-Z,a-z}A-Z,a-z 无衬线字体 A-Z,a-z,0-9 \textsf{A-Z,a-z,0-9}A-Z,a-z,0-9 粗意大利斜体 A-Z,a-z \textbf{\textit{A-Z,a-z}}A-Z,a-z 粗体无衬线 A-Z,a-z,0-9 \textsf{\textbf{A-Z,a-z,0-9}}A-Z,a-z,0-9 手写体 A − Z \mathscr{A-Z}A−Z 斜体无衬线 A-Z,a-z \textsf{\textit{A-Z,a-z }}A-Z,a-z 花体 A − Z , a − z \frak{A-Z,a-z}A−Z,a−z 打字机字体 A-Z,a-z,0-9 \texttt{A-Z,a-z,0-9}A-Z,a-z,0-9 [ 7 ] : [7]:[7]: 这里 U n i c o d e \rm UnicodeUnicode 就是万国码。这里是指 U n i c o d e \rm UnicodeUnicode 里支持的字体样式。关于它们的指令,请参考下面的 字体 一段。

U n i c o d e \rm UnicodeUnicode 上面列出的字母可以在任何 KaTeX \KaTeXK A T E ​ X 模式下正确渲染。

此外,文本模式始终接受 Brahmic \text{Brahmic}Brahmic,Georgian \text{Georgian}Georgian,中文,日文和韩文的字形。但是,这些字形将从系统字体(而不是 KaTeX \KaTeXK A T E ​ X 提供的字体)中呈现,因此它们的版式可能会发生冲突。您可以为 CSS \text{CSS}CSS 类[ 8 ] ^{[8]} [8] .latin-fallback,.cyrillic-fallback,.brahmic-fallback,.georgian-fallback,.cjk-fallback 和 .hangul-fallback中提供规则,以为这些语言提供后备字体。这些字形的使用可能会引起小的垂直对齐问题:KaTeX \KaTeXK A T E ​ X 列出了符号、大多数拉丁字母、希腊和西里尔字母的详细大小度量值,但其他接受的字形则被视为与当前 KaTeX \KaTeXK A T E ​ X 字体中的字母 M \text{M}M 一样高。(因此很多时候 KaTeX \KaTeXK A T E ​ X 用字母 M MM 作为参考大小——编者注)

如果 KaTeX \KaTeXK A T E ​ X 呈现模式的设置中,strict \text{strict}strict 设置为了 false \text{false}false 或 warn \text{warn}warn(默认),则 KaTeX \KaTeXK A T E ​ X 将在文本和数学模式下接受所有 Unicode \text{Unicode}Unicode 字母。所有无法识别的字符将被视为它们以文本模式显示。这样可能会遇到使用系统字体以及使用不正确的垂直对齐方式的问题。

对于波斯语中的复合字符,我们正在开发为用户提供的插件。(虽然你可能不会使用它——编者注)

[ 8 ] : [8]:[8]: 因为没怎么写过 C S S \rm CSSCSS,所以可能说明上有一些问题。

布局 注解/标记 第一列 第二列 5 \cancel{5} 5 ​ \cancel{5} a + b + c ⏞ note \overbrace{a+b+c}^{\text{note}} a+b+c ​

note ​ \overbrace{a+b+c}^{\text{note}} 5 \bcancel{5} 5 ​ \bcancel{5} a + b + c ⏟ note \underbrace{a+b+c}_{\text{note}} note a+b+c ​

​ \underbrace{a+b+c}_{\text{note}} A B C \xcancel{ABC} ABC \xcancel{ABC} ≠ \not =  = \not = a b c \sout{abc} abc \sout{abc} π = c d \boxed{\pi=\frac c d} π= d c ​

​ \boxed{\pi=\frac c d} \tag{hi} x+y^{2x} x + y 2 x (hi) \tag{hi} x+y^{2x} x+y 2x (hi)

\tag{hi} x+y^{2x} x + y 2 x hi \tag{hi} x+y^{2x} x+y 2x hi

换行指令 KaTeX \KaTeXK A T E ​ X 0.10.0 0.10.00.10.0版本之后将在关系或二元运算符(例如“ = ==”或“ + ++”)之后的内联数学中自动插入换行符。你可以通过 \nobreak 或将公式放在一对大括号中来阻止自动换行,例如 {F = ma}。\allowbreak 将允许在关系或运算符以外的其他位置自动换行。

硬换行符是 \ 和 \newline。[ 9 ] ^{[9]} [9]

在数学模式中,KaTeX \KaTeXK A T E ​ X 不会自动插入换行符。但是当渲染选项 strict \text{strict}strict 设置为 true \text{true}true 时,它将忽略显示数学模式并且插入硬换行。

[ 9 ] : [9]:[9]: 软换行换行不换段,硬换行换行也换段。简单来说,KaTeX \KaTeXK A T E ​ X 有时会自动换行,但换行之后仍在同一段,也就是软换行。而硬换行之后,两部分内容就分离了。

垂直布局 第一列 第二列 第三列 x n x_nx n ​ x_n = ! \stackrel{!}{=}

! \stackrel{!}{=} a b a \atop b b a ​ a \atop b e x e^xe x e^x = ! \overset{!}{=}

! \overset{!}{=} a b c a\raisebox{0.25em}{b}ca b c a\raisebox{0.25em}{b}c u o _u^o u o ​ _u^o = ! \underset{!}{=} !

​ \underset{!}{=} ∑ 0 < i < m 0 < j < n \sum_{\substack{0<i<m\0<j<n}}∑ 0<i<m 0<j<n ​

​ \sum_{\substack{0<i<m\0<j<n}} 如果 \raisebox 的第二个参数嵌套在 ... 分隔符内,则可以包含数学运算符,当然前提是整个公式包括在 当中。例如 a\raisebox{0.25em}{$\frac a b$}c 的显示效果为: a a b c a\raisebox{0.25em}{\frac a b}c a b a ​

​ c

重叠和间距 第一列 第二列 = /   {=}\mathllap{/\,}= / {=}\mathllap{/\,} ( x 2 ) \left(x^{\smash{2}}\right)(x 2

) \left(x^{\smash{2}}\right)   / = \mathrlap{\,/}{=} / = \mathrlap{\,/}{=} y \sqrt{\smash[b]{y}} y

​ \sqrt{\smash[b]{y}} ∑ 1 ≤ i ≤ j ≤ n x i j \sum\limits{\mathclap{1\le i\le j\le n}} x{ij} 1≤i≤j≤n ∑ ​ x ij ​ \sum{\mathclap{1\le i\le j\le n}} x{ij}

KaTeX \KaTeXK A T E ​ X 同样支持 \llap[ 10 ] ^{[10]} [10] ,\rlap 和 \clap,但是它们仅能在文本模式中使用,而不是数学模式。

[ 10 ] : [10]:[10]: 这里解释一下这个命令的用处:当我们使用巨运算符时,它的上标/下标可能过长,比如 ∑ 1 ≤ i ≤ j ≤ k ≤ n i × j × k \sum\limits{1\le i\le j \le k \le n}i\times j \times k 1≤i≤j≤k≤n ∑ ​ i×j×k,这样 ijk 离运算符较远。但是当我们用了这些指令,就可以自动缩小这个距离。 ∑ 1 ≤ i ≤ j ≤ k ≤ n i × j × k \sum\limits{\mathclap{1\le i\le j \le k \le n}}i\times j \times k 1≤i≤j≤k≤n ∑ ​ i×j×k

间隔 指令 备注 指令 备注 \, 3 18 e m [ 11 ] \frac{3}{18} \rm em ^{[11]} 18 3 ​ em [11] 的间距 \kern{distance} 宽度为distance的间距 \thinspace 3 18 e m \frac{3}{18} \rm em 18 3 ​ em 的间距 \mkern{distance} 宽度为distance的间距

4 18 e m \frac{4}{18} \rm em 18 4 ​ em 的间距 \mskip{distance} 宽度为distance的间距 \: 4 18 e m \frac{4}{18} \rm em 18 4 ​ em 的间距 \hskip{distance} 宽度为distance的间距 \medspace 4 18 e m \frac{4}{18} \rm em 18 4 ​ em 的间距 \hspace{distance} 宽度为distance的间距 \; 5 18 e m \frac{5}{18} \rm em 18 5 ​ em 间距 \hspace*{distance} 宽度为distance的间距 \thickspace 5 18 e m \frac{5}{18} \rm em 18 5 ​ em 间距 \phantom{content} 长与高等于参数的间距 \enspace 1 2 e m \frac{1}{2} \rm em 2 1 ​ em 间距 \hphantom{content} 高度等于参数的间距 \quad 1 e m 1 \rm em1em 间距 \vphantom{content} 高度等于参数的间距 \qquad 2 e m 2 \rm em2em 间距 ! – 3 18 e m \frac{3}{18} \rm em 18 3 ​ em 间距 ~ 不换行间距 \negthinspace – 3 18 e m \frac{3}{18} \rm em 18 3 ​ em 间距 \space 普通的空格 \negmedspace – 4 18 e m \frac{4}{18} \rm em 18 4 ​ em 间距 \nobreakspace 不换行间距 \negthickspace – 5 18 e m \frac{5}{18} \rm em 18 5 ​ em 间距

提示 distance 参数可以接受任何KaTeX \KaTeXK A T E ​ X的单位。

\kern,\mkern,\mskip 和 \hspace 都可以直接加上距离参数,例如,\kern1em 可以生成一个宽度为 1 e m \rm 1em1em 的空格。

\mkern 和 \mskip 在文本模式下不起作用,并且两者都将为mu以外的任何单位显示警告。

逻辑与集合符号 第一列 第二列 第三列 第四列 ∀ \forall∀ \forall ∁ \complement∁ \complement ∴ \therefore∴ \therefore ∅ \emptyset∅ \emptyset ∃ \exists∃ \exists ⊂ \subset⊂ \subset ∵ \because∵ \because ∅ \empty∅ \empty ∃ \exist∃ \exist ⊃ \supset⊃ \supset ↦ \mapsto↦ \mapsto ∅ \varnothing∅ \varnothing ∄ \nexists∄ \nexists ∣ \mid∣ \mid → \to→ \to    ⟹    \implies⟹ \implies ∈ \in∈ \in ∧ \land∧ \land ← \gets← \gets    ⟸    \impliedby⟸ \impliedby ∈ \isin∈ \isin ∨ \lor∨ \lor ↔ \leftrightarrow↔ \leftrightarrow    ⟺    \iff⟺ \iff ∉ \notin∈ / \notin ∋ \ni∋ \ni ∌ \notni  ∋ \notni ¬ \neg¬ \neg 或者 \lnot 你也可以直接输入这些:∀ ∴ ∁ ∵ ∃ ∣ ∈ ∋ ⊂ ⊃ ∧ ∨ ↦ → ← ↔ ¬ C H N P Q R ∀∴∁∵∃∣∈∋⊂⊃∧∨↦→←↔¬ ℂ ℍ ℕ ℙ ℚ ℝ∀∴∁∵∃∣∈∋⊂⊃∧∨↦→←↔¬CHNPQR。

宏定义 显示效果 代码 x 2 + x 2 \def\foo{x^2} \foo + \foox 2 +x 2 \def\foo{x^2} \foo + \foo y 2 + y 2 \gdef\bar#1{#1^2} \bar{y} + \bar{y}y 2 +y 2 \gdef\bar#1{#1^2} \bar{y} + \bar{y} \global\def\macroname#1#2…{definition} \newcommand\macroname[numargs]{definition} \renewcommand\macroname[numargs]{definition} \providecommand\macroname[numargs]{definition} 你同样可以在 KaTeX \KaTeXK A T E ​ X 的渲染选项中定义宏。[ 12 ] ^{[12]} [12]

宏最多接受九个参数:#1,#2 等。

\gdef 和 \global \def 宏将在数学表达式之间保留。

这些都是合法的指令名称:

\char \mathchoice \TextOrMath \@ifstar \@ifnextchar \@firstoftwo \@secondoftwo \relax

@ 是命令的有效字符,就像你使用了 \makeatletter 指令。[ 13 ] ^{[13]} [13]

[ 12 ] : [12]:[12]: 宏定义类似于 C + + \rm C++C++ 中的 \define,可以简化代码,也可以嵌套。

[ 13 ] : [13]:[13]: 解释一下 \makeatletter 指令:因为部分原因,我们在 TeX \TeXT E ​ X 中无法使用 @ 作为指令名称,除非使用这个指令。而 KaTeX \KaTeXK A T E ​ X 中的 @ 则不需要,所以说“就像你使用了 \makeatletter 指令”。

运算符 巨型运算符[ 14 ] ^{[14]} [14]

第一列 第二列 第三列 第四列 ∑ \sum∑ \sum ∏ \prod∏ \prod ⨂ \bigotimes⨂ \bigotimes ⋁ \bigvee⋁ \bigvee ∫ \int∫ \int ∐ \coprod∐ \coprod ⨁ \bigoplus⨁ \bigoplus ⋀ \bigwedge⋀ \bigwedge ∬ \iint∬ \iint ∫ \intop∫ \intop ⨀ \bigodot⨀ \bigodot ⋂ \bigcap⋂ \bigcap ∭ \iiint∭ \iiint ∫ \smallint∫ \smallint ⨄ \biguplus⨄ \biguplus ⋃ \bigcup⋃ \bigcup ∮ \oint∮ \oint ∯ \oiint ∬ ​ \oiint ∰ \oiiint ∭ ​ \oiiint ⨆ \bigsqcup⨆ \bigsqcup 当然,你也可以直接输入这些: ∫ ∬ ∭ ∮ ∏ ∐ ∑ ⋀ ⋁ ⋂ ⋃ ⨀ ⨁ ⨂ ⨄ ⨆ ∫∬∭∮∏∐∑⋀⋁⋂⋃⨀⨁⨂⨄⨆∫∬∭∮∏∐∑⋀⋁⋂⋃⨀⨁⨂⨄⨆。

二元运算符 第一列 第二列 第三列 第四列

分数和二项式 第一列 第二列 第三列 a b \frac{a}{b} b a ​ \frac{a}{b} a b \tfrac{a}{b} b a ​ \tfrac{a}{b}[ 15 ] ^{[15]} [15] ( a a + 1 ] \genfrac (]{2pt}{1}a{a+1}( a+1 a ​ ] \genfrac (]{2pt}{1}a{a+1} a b {a \over b} b a ​ {a \over b} a b \dfrac{a}{b} b a ​ \dfrac{a}{b} a b + 1 {a \above{2pt} b+1} b+1 a ​ {a \above{2pt} b+1} a 1 + 1 b \cfrac{a}{1 +\cfrac{1}{b}} 1+ b 1 ​

a ​ \cfrac{a}{1 +\cfrac{1}{b}}
( n k ) \binom{n}{k}( k n ​ ) \binom{n}{k} ( n k ) \dbinom{n}{k}( k n ​ ) \dbinom{n}{k} { n k } {n\brace k}{ k n ​ } {n\brace k} ( n k ) {n \choose k}( k n ​ ) {n \choose k} ( n k ) \tbinom{n}{k}( k n ​ ) \tbinom{n}{k} [ n k ] {n\brack k}[ k n ​ ] {n\brack k} [ 15 ] : [15]:[15]: 在洛谷讨论区的 KaTeX \KaTeXK A T E ​ X 版本中,有个 B u g \rm BugBug:嵌套使用 \tfrac{}{} 会导致字体膨胀。

数学运算符 第一列 第二列 第三列 第四列 arcsin ⁡ \arcsinarcsin \arcsin cotg ⁡ \cotgcotg \cotg ln ⁡ \lnln \ln det ⁡ \detdet \det arccos ⁡ \arccosarccos \arccos coth ⁡ \cothcoth \coth log ⁡ \loglog \log gcd ⁡ \gcdgcd \gcd arctan ⁡ \arctanarctan \arctan csc ⁡ \csccsc \csc sec ⁡ \secsec \sec inf ⁡ \infinf \inf arctg ⁡ \arctgarctg \arctg ctg ⁡ \ctgctg \ctg sin ⁡ \sinsin \sin lim ⁡ \limlim \lim arcctg ⁡ \arcctgarcctg \arcctg cth ⁡ \cthcth \cth sinh ⁡ \sinhsinh \sinh lim inf ⁡ \liminfliminf \liminf arg ⁡ \argarg \arg deg ⁡ \degdeg \deg sh ⁡ \shsh \sh lim sup ⁡ \limsuplimsup \limsup ch ⁡ \chch \ch dim ⁡ \dimdim \dim tan ⁡ \tantan \tan max ⁡ \maxmax \max cos ⁡ \coscos \cos exp ⁡ \expexp \exp tanh ⁡ \tanhtanh \tanh min ⁡ \minmin \min cosec ⁡ \coseccosec \cosec hom ⁡ \homhom \hom tg ⁡ \tgtg \tg Pr ⁡ \PrPr \Pr cosh ⁡ \coshcosh \cosh ker ⁡ \kerker \ker th ⁡ \thth \th sup ⁡ \supsup \sup cot ⁡ \cotcot \cot lg ⁡ \lglg \lg arg max ⁡ \argmaxargmax \argmax arg min ⁡ \argminargmin \argmin plim ⁡ \plimplim \plim f ⁡ \operatorname{f}f \operatorname{f} f ⁡ \operatorname{f}f \operatorname{f}
参数显示在右侧的公式,如 ∑ i = 1 n \sum{i=1}^{n}∑ i=1 n ​ 可以使用\lim its 强行显示在上下侧,∑ i = 1 n \sum\limits{i=1}^{n} i=1 ∑ n ​ ,\sum\limits_{i=1}^{n}。

开根 x \sqrt{x} x ​ \sqrt{x}

x 3 \sqrt[3]{x} 3

x ​ \sqrt[3]{x}

关系指令 = ! \stackrel{!}{=}

! \stackrel{!}{=}

第一列 第二列 第三列 第四列 = == = ≖ \eqcirc≖ \eqcirc ⋚ \lesseqgtr⋚ \lesseqgtr ⊐ \sqsupset⊐ \sqsupset < << < ∹ \eqcolon−: \eqcolon ⪋ \lesseqqgtr⪋ \lesseqqgtr ⊒ \sqsupseteq⊒ \sqsupseteq

− ∷ \Eqcolon−:: \Eqcolon ≶ \lessgtr≶ \lessgtr ⋐ \Subset⋐ \Subset : :: : ≕ \eqqcolon=: \eqqcolon ≲ \lesssim≲ \lesssim ⊂ \subset⊂ \subset 或者 \sub ≈ \approx≈ \approx = ∷ \Eqqcolon=:: \Eqqcolon ≪ \ll≪ \ll ⊆ \subseteq⊆ \subseteq 或者 \sube ≊ \approxeq≊ \approxeq ≂ \eqsim≂ \eqsim ⋘ \lll⋘ \lll ⫅ \subseteqq⫅ \subseteqq ≍ \asymp≍ \asymp ⪖ \eqslantgtr⪖ \eqslantgtr ⋘ \llless⋘ \llless ≻ \succ≻ \succ ∍ \backepsilon∍ \backepsilon ⪕ \eqslantless⪕ \eqslantless < \lt< \lt ⪸ \succapprox⪸ \succapprox ∽ \backsim∽ \backsim ≡ \equiv≡ \equiv ∣ \mid∣ \mid ≽ \succcurlyeq≽ \succcurlyeq ⋍ \backsimeq⋍ \backsimeq ≒ \fallingdotseq≒ \fallingdotseq ⊨ \models⊨ \models ⪰ \succeq⪰ \succeq ≬ \between≬ \between ⌢ \frown⌢ \frown ⊸ \multimap⊸ \multimap ≿ \succsim≿ \succsim ⋈ \bowtie⋈ \bowtie ≥ \ge≥ \ge ∋ \owns∋ \owns ⋑ \Supset⋑ \Supset ≏ \bumpeq≏ \bumpeq ≥ \geq≥ \geq ∥ \parallel∥ \parallel ⊃ \supset⊃ \supset ≎ \Bumpeq≎ \Bumpeq ≧ \geqq≧ \geqq ⊥ \perp⊥ \perp ⊇ \supseteq⊇ \supseteq 或者 \supe ≗ \circeq≗ \circeq ⩾ \geqslant⩾ \geqslant ⋔ ⋔ \pitchfork⋔⋔⋔ \pitchfork ⫆ \supseteqq⫆ \supseteqq : ≈ \colonapprox:≈ \colonapprox ≫ \gg≫ \gg ≺ \prec≺ \prec ≈ \thickapprox≈ \thickapprox ∷ ≈ \Colonapprox::≈ \Colonapprox ⋙ \ggg⋙ \ggg ⪷ \precapprox⪷ \precapprox ∼ \thicksim∼ \thicksim : − \coloneq:− \coloneq ⋙ \gggtr⋙ \gggtr ≼ \preccurlyeq≼ \preccurlyeq ⊴ \trianglelefteq⊴ \trianglelefteq ∷ − \Coloneq::− \Coloneq > \gt> \gt ⪯ \preceq⪯ \preceq ≜ \triangleq≜ \triangleq ≔ \coloneqq:= \coloneqq ⪆ \gtrapprox⪆ \gtrapprox ≾ \precsim≾ \precsim ⊵ \trianglerighteq⊵ \trianglerighteq ∷ = \Coloneqq::= \Coloneqq ⋛ \gtreqless⋛ \gtreqless ∝ \propto∝ \propto ∝ \varpropto∝ \varpropto : ∼ \colonsim:∼ \colonsim ⪌ \gtreqqless⪌ \gtreqqless ≓ \risingdotseq≓ \risingdotseq △ \vartriangle△ \vartriangle ∷ ∼ \Colonsim::∼ \Colonsim ≷ \gtrless≷ \gtrless ∣ \shortmid∣ \shortmid ⊲ \vartriangleleft⊲ \vartriangleleft ≅ \cong≅ \cong ≳ \gtrsim≳ \gtrsim ∥ \shortparallel∥ \shortparallel ⊳ \vartriangleright⊳ \vartriangleright ⋞ \curlyeqprec⋞ \curlyeqprec ∈ \in∈ \in 或者 \isin ∼ \sim∼ \sim : \vcentcolon: \vcentcolon ⋟ \curlyeqsucc⋟ \curlyeqsucc ⋈ \Join⋈ \Join ≃ \simeq≃ \simeq ⊢ \vdash⊢ \vdash ⊣ \dashv⊣ \dashv ≤ \le≤ \le ⌢ \smallfrown⌢ \smallfrown ⊨ \vDash⊨ \vDash ∷ \dblcolon:: \dblcolon ≤ \leq≤ \leq ⌣ \smallsmile⌣ \smallsmile ⊩ \Vdash⊩ \Vdash ≐ \doteq≐ \doteq ≦ \leqq≦ \leqq ⌣ \smile⌣ \smile ⊪ \Vvdash⊪ \Vvdash ≑ \Doteq≑ \Doteq ⩽ \leqslant⩽ \leqslant ⊏ \sqsubset⊏ \sqsubset
≑ \doteqdot≑ \doteqdot ⪅ \lessapprox⪅ \lessapprox ⊑ \sqsubseteq⊑ \sqsubseteq
当然,你也可以直接输入这些:

箭头 第一列 第二列 第三列 ↺ \circlearrowleft↺ \circlearrowleft ↼ \leftharpoonup↼ \leftharpoonup ⇒ \rArr⇒ \rArr ↻ \circlearrowright↻ \circlearrowright ⇇ \leftleftarrows⇇ \leftleftarrows → \rarr→ \rarr ↶ \curvearrowleft↶ \curvearrowleft ↔ \leftrightarrow↔ \leftrightarrow ↾ \restriction↾ \restriction ↷ \curvearrowright↷ \curvearrowright ⇔ \Leftrightarrow⇔ \Leftrightarrow → \rightarrow→ \rightarrow ⇓ \Darr⇓ \Darr ⇆ \leftrightarrows⇆ \leftrightarrows ⇒ \Rightarrow⇒ \Rightarrow ⇓ \dArr⇓ \dArr ⇋ \leftrightharpoons⇋ \leftrightharpoons ↣ \rightarrowtail↣ \rightarrowtail ↓ \darr↓ \darr ↭ \leftrightsquigarrow↭ \leftrightsquigarrow ⇁ \rightharpoondown⇁ \rightharpoondown ⇠ \dashleftarrow⇠ \dashleftarrow ⇚ \Lleftarrow⇚ \Lleftarrow ⇀ \rightharpoonup⇀ \rightharpoonup ⇢ \dashrightarrow⇢ \dashrightarrow ⟵ \longleftarrow⟵ \longleftarrow ⇄ \rightleftarrows⇄ \rightleftarrows ↓ \downarrow↓ \downarrow ⟸ \Longleftarrow⟸ \Longleftarrow ⇌ \rightleftharpoons⇌ \rightleftharpoons ⇓ \Downarrow⇓ \Downarrow ⟷ \longleftrightarrow⟷ \longleftrightarrow ⇉ \rightrightarrows⇉ \rightrightarrows ⇊ \downdownarrows⇊ \downdownarrows ⟺ \Longleftrightarrow⟺ \Longleftrightarrow ⇝ \rightsquigarrow⇝ \rightsquigarrow ⇃ \downharpoonleft⇃ \downharpoonleft ⟼ \longmapsto⟼ \longmapsto ⇛ \Rrightarrow⇛ \Rrightarrow ⇂ \downharpoonright⇂ \downharpoonright ⟶ \longrightarrow⟶ \longrightarrow ↱ \Rsh↱ \Rsh ← \gets← \gets ⟹ \Longrightarrow⟹ \Longrightarrow ↘ \searrow↘ \searrow ⇔ \Harr⇔ \Harr ↫ \looparrowleft↫ \looparrowleft ↙ \swarrow↙ \swarrow ⇔ \hArr⇔ \hArr ↬ \looparrowright↬ \looparrowright → \to→ \to ↔ \harr↔ \harr ⇔ \Lrarr⇔ \Lrarr ↞ \twoheadleftarrow↞ \twoheadleftarrow ↩ \hookleftarrow↩ \hookleftarrow ⇔ \lrArr⇔ \lrArr ↠ \twoheadrightarrow↠ \twoheadrightarrow ↪ \hookrightarrow↪ \hookrightarrow ↔ \lrarr↔ \lrarr ⇑ \Uarr⇑ \Uarr    ⟺    \iff⟺ \iff ↰ \Lsh↰ \Lsh ⇑ \uArr⇑ \uArr    ⟸    \impliedby⟸ \impliedby ↦ \mapsto↦ \mapsto ↑ \uarr↑ \uarr    ⟹    \implies⟹ \implies ↗ \nearrow↗ \nearrow ↑ \uparrow↑ \uparrow ⇐ \Larr⇐ \Larr ↚ \nleftarrow↚ \nleftarrow ⇑ \Uparrow⇑ \Uparrow ⇐ \lArr⇐ \lArr ⇍ \nLeftarrow⇍ \nLeftarrow ↕ \updownarrow↕ \updownarrow ← \larr← \larr ↮ \nleftrightarrow↮ \nleftrightarrow ⇕ \Updownarrow⇕ \Updownarrow ⇝ \leadsto⇝ \leadsto ⇎ \nLeftrightarrow⇎ \nLeftrightarrow ↿ \upharpoonleft↿ \upharpoonleft ← \leftarrow← \leftarrow ↛ \nrightarrow↛ \nrightarrow ↾ \upharpoonright↾ \upharpoonright ⇐ \Leftarrow⇐ \Leftarrow ⇏ \nRightarrow⇏ \nRightarrow ⇈ \upuparrows⇈ \upuparrows ↢ \leftarrowtail↢ \leftarrowtail ↖ \nwarrow↖ \nwarrow
↽ \leftharpoondown↽ \leftharpoondown ⇒ \Rarr⇒ \Rarr
你也可以直接输入这些: ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↞ ↠ ↢ ↣ ↦ ↩ ↪ ↫ ↬ ↭ ↮ ↰ ↱↶ ↷ ↺ ↻ ↼ ↽ ↾ ↾ ↿ ⇀ ⇁ ⇂ ⇃ ⇄ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌⇍ ⇎ ⇏ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇚ ⇛ ⇝ ⇠ ⇢ 。

箭头扩展[ 16 ] ^{[16]} [16]

第一列 第二列 ← a b c \xleftarrow{abc} abc ​ \xleftarrow{abc} → u n d e r o v e r \xrightarrow[under]{over} over under ​ \xrightarrow[under]{over} ⇐ a b c \xLeftarrow{abc} abc ​ \xLeftarrow{abc} ⇒ a b c \xRightarrow{abc} abc ​ \xRightarrow{abc} ↔ a b c \xleftrightarrow{abc} abc ​ \xleftrightarrow{abc} ⇔ a b c \xLeftrightarrow{abc} abc ​ \xLeftrightarrow{abc} ↩ a b c \xhookleftarrow{abc} abc ​ \xhookleftarrow{abc} ↪ a b c \xhookrightarrow{abc} abc ​ \xhookrightarrow{abc} ↞ a b c \xtwoheadleftarrow{abc} abc \xtwoheadleftarrow{abc} ↠ a b c \xtwoheadrightarrow{abc} abc \xtwoheadrightarrow{abc} ↼ a b c \xleftharpoonup{abc} abc ​ \xleftharpoonup{abc} ⇀ a b c \xrightharpoonup{abc} abc ​ \xrightharpoonup{abc} ↽ a b c \xleftharpoondown{abc} abc ​ \xleftharpoondown{abc} ⇁ a b c \xrightharpoondown{abc} abc ​ \xrightharpoondown{abc} ⇋ a b c \xleftrightharpoons{abc} abc ​ \xleftrightharpoons{abc} ⇌ a b c \xrightleftharpoons{abc} abc ​ \xrightleftharpoons{abc} ⇄ a b c \xtofrom{abc} abc ​ \xtofrom{abc} ↦ a b c \xmapsto{abc} abc ​ \xmapsto{abc} = a b c \xlongequal{abc} abc \xlongequal{abc}
可扩展的箭头都可以用相同的方式接受可选参数,比如说,\xrightarrow[under]{over} 显示出来就是 → u n d e r o v e r \xrightarrow[under]{over} over under ​ 。

样式,颜色,大小和字体 类的分配[ 17 ] ^{[17]} [17]

\mathbin \mathclose \mathinner \mathop

\mathopen \mathord \mathpunct \mathrel

颜色 F = m a \color{blue} F=maF=ma \color{blue} F=ma

请注意,KaTeX \KaTeXK A T E ​ X 中的\color的作用类似于开关,使用后一定范围内所有的字体都会改变颜色。这与LaTeX \LaTeXL A T E ​ X一致,但是与M a t h J a x \rm MathJaxMathJax不同。而KaTeX \KaTeXK A T E ​ X得其他颜色指令中,它的颜色和内容都是参数;

F = m a \textcolor{blue}{F=ma}F=ma\textcolor{#228B22}{F=ma}

A \colorbox{aqua}{A} A ​ \colorbox{aqua}{A}[ 18 ] ^{[18]} [18]

A \fcolorbox{red}{aqua}{A} A ​ \fcolorbox{red}{aqua}{A}

对于颜色的名称,KaTeX \KaTeXK A T E ​ X颜色函数将接受标准的H T M L \rm HTMLHTML预定义颜色名称。他们还将接受C S S \rm CSSCSS十六进制样式的R G B \rm RGBRGB参数,比如#ff0000表示红色,而其中的#是可选的。(不过洛谷讨论区版本较旧,因此在那里必须加#)。

[ 18 ] : [18]:[18]: \colorbox和\fcolorbox 里面不能嵌套环境,但是\box能。

字体 第一列 第二列 第三列 A b 0 \mathrm{Ab0}Ab0 \mathrm{Ab0} A b 0 \mathbf{Ab0}Ab0 \mathbf{Ab0} A b 0 \mathit{Ab0}Ab0 \mathit{Ab0} A b 0 \mathnormal{Ab0}Ab0 \mathnormal{Ab0} Ab0 \textbf{Ab0}Ab0 \textbf{Ab0} Ab0 \textit{Ab0}Ab0 \textit{Ab0} Ab0 \textrm{Ab0}Ab0 \textrm{Ab0} A b 0 \bf{Ab0}Ab0 \bf{Ab0} A b 0 \it{Ab0}Ab0 \it Ab0 A b 0 \rm{Ab0}Ab0 \rm{Ab0} A b 0 \bold{Ab0}Ab0 \bold{Ab0} Ab0 \textup{Ab0}Ab0 \textup{Ab0} Ab0 \textnormal{Ab0}Ab0 \textnormal{Ab0} A b 0 \boldsymbol{Ab0}Ab0 \boldsymbol{Ab} A B \Bbb{AB}AB \Bbb{AB} Ab0 \text{Ab0}Ab0 \text{Ab0} A b 0 \bm{Ab0}Ab0 \bm{Ab0} A B \mathbb{AB}AB \mathbb{AB} A b 0 \mathsf{Ab0}Ab0 \mathsf{Ab0} Ab0 \textmd{Ab0}Ab0 \textmd{Ab0} A b 0 \frak{Ab0}Ab0 \frak{Ab0} Ab0 \textsf{Ab0}Ab0 \textsf{Ab0} A b 0 \mathtt{Ab0}Ab0 \mathtt{Ab0} A b 0 \mathfrak{Ab0}Ab0 \mathfrak{Ab0} A b 0 \sf{Ab0}Ab0 \sf Ab0 Ab0 \texttt{Ab0}Ab0 \texttt{Ab0} A B 0 \mathcal{AB0}AB0 \mathcal{AB0} A b 0 \tt{Ab0}Ab0 \tt Ab0 A B \mathscr{AB}AB \mathscr{AB} 通过使用\textXX类型的字体指令,可以堆叠字体样式、粗细和形状。 因此\textsf{\textbf{H}}将渲染出H \textsf{\textbf{H}}H。其他字体指令不会堆叠,例如\mathsf{\mathbf{H}}将渲染出H \mathsf{\mathbf {H}}H。

如果 KaTeX \KaTeXK A T E ​ X 字体没有粗体字形,你可以使用 \pmb 指令可以模拟一个。

大小 第一列 第二列 A B \Huge ABAB \Huge AB A B \normalsize ABAB \normalsize AB A B \huge ABAB \huge AB A B \small ABAB \small AB A B \LARGE ABAB \LARGE AB A B \footnotesize ABAB \footnotesize AB A B \Large ABAB \Large AB A B \scriptsize ABAB \scriptsize AB A B \large ABAB \large AB A B \tiny ABAB \tiny AB 样式 显示效果 代码 ∑ i = 1 n \displaystyle\sum{i=1}^n i=1 ∑ n ​ \displaystyle\sum{i=1}^n ∑ i = 1 n \textstyle\sum{i=1}^n∑ i=1 n ​ \textstyle\sum{i=1}^n x \scriptstyle xx \scriptstyle x (The size of a first sub/superscript) x \scriptscriptstyle xx \scriptscriptstyle x (The size of subsequent sub/superscripts) lim ⁡ x \lim\limits_x x lim ​ \lim\limits_x lim ⁡ x \lim\nolimits_xlim x ​ \lim\nolimits_x x^2 \verb!x^2!x^2 \verb!x^2![ 19 ] ^{[19]} [19]

在居中的环境下(即在 当中),在\text{}里面可以放置...用来显示数学模式。

符号和标点 第一列 第二列 第三列 % 注释% 注释 … \dots… \dots KaTeX \KaTeXK A T E ​ X \KaTeX % \%% \% ⋯ \cdots⋯ \cdots LaTeX \LaTeXL A T E ​ X \LaTeX

## # ⋱ \ddots⋱ \ddots TeX \TeXT

E ​ X \TeX & \&& \& … \ldots… \ldots ∇ \nabla∇ \nabla _ _ ⋮ \vdots⋮ \vdots ∞ \infty∞ \infty \text{\textunderscore} \text{\textunderscore} ⋯ \dotsb⋯ \dotsb ∞ \infin∞ \infin – \text{--}– \text{--} … \dotsc… \dotsc ✓ \checkmark✓ \checkmark – \text{\textendash}– \text{\textendash}  ⁣ ⋯ \dotsi⋯ \dotsi † \dag† \dag — \text{---}— \text{---} ⋯ \dotsm⋯ \dotsm † \dagger† \dagger — \text{\textemdash}— \text{\textemdash} … \dotso… \dotso † \text{\textdagger}† \text{\textdagger} ~ \text{\textasciitilde}~\text{\textasciitilde} ⋅ ⋅ \sdot⋅⋅⋅ \sdot ‡ \ddag‡ \ddag ^ \text{\textasciicircum}^ \text{\textasciicircum} … \mathellipsis… \mathellipsis ‡ \ddagger‡ \ddagger [ 20 ] ^{[20]} [20] … \text{\textellipsis}… \text{\textellipsis} ‡ \text{\textdaggerdbl}‡ \text{\textdaggerdbl} ‘ \text{\textquoteleft}‘ text{\textquoteleft} □ \Box□ \Box ‡ \Dagger‡ \Dagger ‘ \lq‘ \lq □ \square□ \square ∠ \angle∠ \angle ’ \text{\textquoteright}’ \text{\textquoteright} ■ \blacksquare■ \blacksquare ∡ \measuredangle∡ \measuredangle ′ \rq ′ \rq △ \triangle△ \triangle ∢ \sphericalangle∢ \sphericalangle “ \text{\textquotedblleft}“ \text{\textquotedblleft} ▽ \triangledown▽ \triangledown ⊤ \top⊤ \top " "" " ◃ \triangleleft◃ \triangleleft ⊥ \bot⊥ \bot ” \text{\textquotedblright}” \text{\textquotedblright} ▹ \triangleright▹ \triangleright
 ⁣ : \colon: \colon ▽ \bigtriangledown▽ \bigtriangledown \text{\textdollar} \text{\textdollar} ‵ \backprime‵ \backprime △ \bigtriangleup△ \bigtriangleup £ \pounds£ \pounds ′ \prime′ \prime ▲ \blacktriangle▲ \blacktriangle £ \mathsterling£ \mathsterling < \text{\textless}< \text{\textless} ▼ \blacktriangledown▼ \blacktriangledown £ \text{\textsterling}£ \text{\textsterling}

\text{\textgreater}> \text{\textgreater} ◀ \blacktriangleleft◀ \blacktriangleleft ¥ \yen¥ \yen | \text{\textbar}| \text{\textbar} ▶ \blacktriangleright▶ \blacktriangleright √ \surd√ \surd ∥ \text{\textbardbl}∥ \text{\textbardbl} ⋄ \diamond⋄ \diamond ° \degree° \degree { \text{\textbraceleft}{ \text{\textbraceleft} ◊ \Diamond◊ \Diamond ° \text{\textdegree}° \text{\textdegree} } \text{\textbraceright}} \text{\textbraceright} ◊ \lozenge◊ \lozenge ℧ \mho℧ \mho \ \text{\textbackslash}\ \text{\textbackslash} ⧫ \blacklozenge⧫ \blacklozenge ╲ \diagdown╲ \diagdown ¶ \text{\P}¶ \text{\P} ⋆ \star⋆ \star ╱ \diagup╱ \diagup § \text{\S}§ \text{\S} ★ \bigstar★ \bigstar ♭ \flat♭ \flat § \text{\sect}§ \text{\sect} ♣ \clubsuit♣ \clubsuit ♮ \natural♮ \natural © \copyright c ◯ \copyright ♣ \clubs♣ \clubs ♯ \sharp♯ \sharp ® \circledR® \circledR ♢ \diamondsuit♢ \diamondsuit ♡ \heartsuit♡ \heartsuit ® \text{\textregistered} R ◯ \text{\textregistered} ♢ \diamonds♢ \diamonds ♡ \hearts♡ \hearts Ⓢ \circledSⓈ \circledS ♠ \spadesuit♠ \spadesuit ♠ \spades♠ \spades a ◯ \text{\textcircled a} a ◯ \text{\textcircled a} ✠ \maltese✠ \maltese
你也可以直接输入这些:£ ¥ ∇ ∞ · ∠ ∡ ∢ ♠ ♡ ♢ ♣ ♭ ♮ ♯ ✓ … ⋮ ⋯ ⋱ !

[ 20 ] : [20]:[20]: 同样由于 M a r k d o w n \rm MarkdownMarkdown 制表问题,无法显示字符 \。这里的显示效果就是 ‘ \lq‘,同 \lq。

单位 在 KaTeX \KaTeXK A T E ​ X 中,单位与在 TeX \TeXT E ​ X 中一样按比例进行处理。

但是很多地方,KaTeX \KaTeXK A T E ​ X单位不同于C S S \rm CSSCSS单位。

KaTeX单位 \text{\KaTeX 单位}K A T E ​ X单位 备注 \text{备注}备注 KaTeX单位 \text{\KaTeX 单位}K A T E ​ X单位 备注 \text{备注}备注 em \text{em}em CSS em \text{CSS em}CSS em bp \text{bp}bp 1 / 72 i n c h × F × G \rm 1/72 inch × F × G1/72inch×F×G ex \text{ex}ex CSS ex \text{CSS ex}CSS ex pc \text{pc}pc 12 KaTeXpt \text{12 \KaTeX pt}12 K A T E ​ Xpt mu \text{mu}mu 1/18 CSS em \text{1/18 CSS em}1/18 CSS em dd \text{dd}dd 1238/1157 KaTeXpt \text{1238/1157 \KaTeX pt}1238/1157 K A T E ​ Xpt pt \text{pt}pt 1 / 72.27 i n c h × F × G \rm {1/72.27 inch × F × G}1/72.27inch×F×G cc \text{cc}cc 14856/1157 KaTeXpt \text{14856/1157 \KaTeX pt}14856/1157 K A T E ​ Xpt mm \text{mm}mm 1 m m × F × G \rm {1 mm × F × G}1mm×F×G nd \text{nd}nd 685/642 KaTeXpt \text{685/642 \KaTeX pt}685/642 K A T E ​ Xpt cm \text{cm}cm 1 c m × F × G \rm {1 cm × F × G}1cm×F×G nc \text{nc}nc 1370/107 KaTeXpt \text{1370/107 \KaTeX pt}1370/107 K A T E ​ Xpt in \text{in}in 1 i n c h × F × G \rm {1 inch × F × G}1inch×F×G sp \text{sp}sp 1/65536 KaTeXpt \text{1/65536 \KaTeX pt}1/65536 K A T E ​ Xpt 其中,

F = F=F=(围绕着H T M L \rm HTMLHTML文字的字体大小)/(10 p t \rm 10 pt10pt) G GG默认情况下为1.21 1.211.21,因为KaTeX \KaTeXK A T E ​ X字体大小通常为1.21 × 1.21\times1.21×周围字体大小。H T M L \rm HTMLHTML网页的C S S \rm CSSCSS可以覆盖此值。 样式和大小的影响范围:

单位 文本模式 s c r i p t \rm scriptscript大小[ 21 ] ^{[21]} [21] h u g e \rm hugehuge大小 em 与 ex \text{em 与 ex}em 与 ex \rule{1em}{1em} \scriptscriptstyle\rule{1em}{1em} \huge\rule{1em}{1em} mu \text{mu}mu \rule{18mu}{18mu} \scriptscriptstyle\rule{18mu}{18mu} \huge\rule{18mu}{18mu} 其他 \text{其他}其他 \rule{10pt}{10pt} \scriptscriptstyle\rule{10pt}{10pt} ————————————————

                        BY xzz_0611 请经过本人允许后在进行转载

原文链接:https://blog.csdn.net/xzz_0611/article/details/137352916