前言
这张表应该涵盖了纯 KaTeX \KaTeX KATEX所有的功能。当然, LaTeX \LaTeX LATEX公式大全亦可作为部分参考。下面是搬运部分。
受支持的功能
这是一张由 KaTeX \KaTeX KATEX支持的 TeX \TeX TEX公式清单。他按照逻辑顺序分类。
这有一个相似的按照字典序排列的支持表。那张表格同样写出了不受支持的公式。
声调记号
第一列 | 第二列 | 第三列 |
---|---|---|
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} | $\text{\v{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 Markdown
Markdown的代码块冲突,这里说明一下,这个音标的代码其实是\+波浪线对应按键+{}
。
另请参阅 字母 章节。
定界符(括号之类)
第一列 | 第二列 | 第三列 | 第四列 | 第五列 |
---|---|---|---|---|
(
)
()
() () |
(
)
\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 |
∣
|
∣ | |
∥
\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 Markdown
Markdown的制表与|
有冲突,因此无法在表格中显示
∣
|
∣。
[
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
\KaTeX
KATEX提供了一些指令来调整括号的大小。另外,这里\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 \begin{matrix}a & b \\c & d\end{matrix} acbd | \ 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{aligned}&\tt \backslash begin\{matrix\} \\&\tt\quad a \& b \backslash \backslash \\ &\tt\quad c \& d \\&\tt \backslash end{matrix} \\\end{aligned} \begin{matrix}a&b\\c&d\endmatrix | a b c d \begin{array}{cc}a & b \\c & d\end{array} acbd | \ 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{aligned}&\tt \backslash begin\{array\}\{cc\}\\&\tt\quad a \& b \backslash \backslash\\&\tt\quad c \& d\\&\tt \backslash end\{array\}\\\end{aligned} \begin{array}{cc}a&b\\c&d\end{array} |
( a b c d ) \begin{pmatrix}a & b \\c & d\end{pmatrix} (acbd) | \ 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{aligned}&\tt\backslash begin\{pmatrix\}\\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \& d\\&\tt\backslash end\{pmatrix\}\\\end{aligned} \begin{pmatrix}a&b\\c&d\end{pmatrix} | [ a b c d ] \begin{bmatrix}a & b \\c & d\end{bmatrix} [acbd] | \ 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{aligned}&\tt\backslash begin\{bmatrix\} \\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \& d \\&\tt\backslash end\{bmatrix\} \\\end{aligned} \begin{bmatrix}a&b\\c&d\end{bmatrix} |
∣ a b c d ∣ \begin{vmatrix}a & b \\c & d\end{vmatrix} acbd | \ 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{aligned}&\tt\backslash begin\{vmatrix\}\\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \ d\\&\tt\backslash end\{vmatrix\}\\\end{aligned} \begin{vmatrix}a&b\\c d\end{vmatrix} | ∥ a b c d ∥ \begin{Vmatrix}a & b \\c & d\end{Vmatrix} acbd | \ 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{aligned}&\tt\backslash begin\{Vmatrix\}\\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \ d\\&\tt\backslash end\{Vmatrix\}\\\end{aligned} \begin{Vmatrix}a&b\\c d\end{Vmatrix} |
{ a b c d } \begin{Bmatrix}a & b \\c & d\end{Bmatrix} {acbd} | \ 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{aligned}&\tt\backslash begin\{Bmatrix\}\\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \ d\\&\tt\backslash end\{Bmatrix\}\\\end{aligned} \begin{Bmatrix}a&b\\c d\end{Bmatrix} | a b c d e f g h i \def\arraystretch{1.5} \begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\\hdashline g & h & i\end{array} adgbehcfi | \ 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 } \begin{aligned}&\tt\backslash def\backslash arraystretch\{1.5\}\\&\tt\quad \backslash begin\{array\}\{c:c:c\}\\&\tt\quad a \& b \& c \backslash\backslash \backslash hline\\&\tt\quad d \& e \& f \backslash \backslash\\&\tt\quad \backslash hdashline\\&\tt\quad g \& h \& i\\&\tt\backslash end\{array\}\end{aligned} \def\arraystretch{1.5}\begin{array}{c:c:c}a&b&c\\\hlined&e&f\\\hdashlineg&h&i\end{array} |
a = b + c d + e = f \begin{aligned}a&=b+c \\d+e&=f\end{aligned} ad+e=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 } \begin{aligned}&\tt\backslash \{aligned\}\\&\tt\quad a\&=b+c \backslash \backslash \\&\tt\quad d+e\&=f\\&\tt\backslash end\{aligned\}\\\end{aligned} \{aligned}a&=b+c\\d+e&=f\end{aligned} | 10 x + 3 y = 2 3 x + 13 y = 4 \begin{alignedat}{2}10&x+ &3&y = 2 \\3&x+&13&y = 4\end{alignedat} 103x+x+313y=2y=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{aligned}&\tt\backslash begin\{alignedat\}\{2\}\\&\tt\quad 10\&x+ \&3\&y = 2 \backslash \backslash \\&\tt\quad 3\&x+\&13\&y = 4\\&\tt\backslash end\{alignedat\}\\\end{aligned} \begin{alignedat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignedat} |
a = b e = b + c \begin{gathered}a=b \\e=b+c\end{gathered} a=be=b+c | \ b e g i n { g a t h e r e d } a = b \ \ e = b + c \ e n d { g a t h e r e d } \begin{aligned}&\tt\backslash begin\{gathered\}\\&\tt\quad a=b \backslash\backslash\\&\tt\quad e=b+c\\&\tt\backslash end\{gathered\}\\\end{aligned} \begin{gathered}a=b\\e=b+c\end{gathered} | x = { a if b c if d x = \begin{cases}a &\text{if } b \\c &\text{if } d\end{cases} x={acif bif d | x = \ b e g i n { c a s e s } a & { i f } b \ \ c & { i f } d \ e n d c a s e s \begin{aligned}&\tt x = \backslash begin\{cases\} \\&\tt\quad a \&\text\{if \} b \backslash\backslash \\&\tt\quad c \&\text\{if \} d\\&\tt\backslash end{cases}\\\end{aligned} x=\begin{cases}a&{if}b\\c&{if}d\endcases |
a b c d \begin{smallmatrix}a & b \\c & d\end{smallmatrix} acbd | \ 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{aligned}&\tt\backslash begin\{smallmatrix\}\\&\tt\quad a \& b \backslash \backslash \\&\tt\quad c \ d\\&\tt\backslash end\{smallmatrix\}\\\end{aligned} \begin{smallmatrix}a&b\\c d\end{smallmatrix} |
[ 6 ] : [6]: [6]: 因为相关原因,在表格里换行不是很方便,因此这里直接嵌入的是 KaTeX \KaTeX KATEX。
Unicode \text{Unicode} Unicode [ 7 ] ^{[7]} [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 Unicode Unicode就是万国码。这里是指 U n i c o d e \rm Unicode Unicode里支持的字体样式。关于它们的指令,请参考下面的“字体”一段。
Unicode \text{Unicode} Unicode
上面列出的字母可以在任何 KaTeX \KaTeX KATEX模式下正确渲染。
此外,文本模式始终接受
Brahmic
\text{Brahmic}
Brahmic,
Georgian
\text{Georgian}
Georgian,中文,日文和韩文的字形。但是,这些字形将从系统字体(而不是
KaTeX
\KaTeX
KATEX提供的字体)中呈现,因此它们的版式可能会发生冲突。您可以为
CSS
\text{CSS}
CSS类
[
8
]
^{[8]}
[8].latin-fallback
,.cyrillic-fallback
,.brahmic-fallback
,.georgian-fallback
,.cjk-fallback
和.hangul-fallback
中提供规则,以为这些语言提供后备字体。这些字形的使用可能会引起小的垂直对齐问题:
KaTeX
\KaTeX
KATEX列出了符号、大多数拉丁字母、希腊和西里尔字母的详细大小度量值,但其他接受的字形则被视为与当前
KaTeX
\KaTeX
KATEX字体中的字母
M
\text{M}
M一样高。(因此很多时候
KaTeX
\KaTeX
KATEX用字母
M
M
M作为参考大小——编者注)
如果 KaTeX \KaTeX KATEX呈现模式的设置中, strict \text{strict} strict设置为了 false \text{false} false或 warn \text{warn} warn(默认),则 KaTeX \KaTeX KATEX将在文本和数学模式下接受所有 Unicode \text{Unicode} Unicode字母。所有无法识别的字符将被视为它们以文本模式显示。这样可能会遇到使用系统字体以及使用不正确的垂直对齐方式的问题。
对于波斯语中的复合字符,我们正在开发为用户提供的插件。(虽然你可能不会使用它——编者注)
[ 8 ] : [8]: [8]: 因为没怎么写过 C S S \rm CSS CSS,所以可能说明上有一些问题。
布局
注解/标记
第一列 | 第二列 |
---|---|
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}
π=dc \boxed{\pi=\frac c d} |
\tag{hi} x+y^{2x}
x + y 2 x (hi) \tag{hi} x+y^{2x} x+y2x(hi)
\tag*{hi} x+y^{2x}
x + y 2 x hi \tag*{hi} x+y^{2x} x+y2xhi
换行指令
KaTeX
\KaTeX
KATEX
0.10.0
0.10.0
0.10.0版本之后将在关系或二元运算符(例如“
=
=
=”或“
+
+
+”)之后的内联数学中自动插入换行符。你可以通过\nobreak
或将公式放在一对大括号中来阻止自动换行,例如{F = ma}
。\allowbreak
将允许在关系或运算符以外的其他位置自动换行。
硬换行符是\\
和\newline
。
[
9
]
^{[9]}
[9]
在数学模式中, KaTeX \KaTeX KATEX不会自动插入换行符。但是当渲染选项 strict \text{strict} strict设置为 true \text{true} true时,它将忽略显示数学模式并且插入硬换行。
[ 9 ] : [9]: [9]: 软换行换行不换段,硬换行换行也换段。简单来说, KaTeX \KaTeX KATEX有时会自动换行,但换行之后仍在同一段,也就是软换行。而硬换行之后,两部分内容就分离了。
垂直布局
第一列 | 第二列 | 第三列 |
---|---|---|
x
n
x_n
xn x_n |
=
!
\stackrel{!}{=}
=! \stackrel{!}{=} |
a
b
a \atop b
ba a \atop b |
e
x
e^x
ex e^x |
=
!
\overset{!}{=}
=! \overset{!}{=} |
a
b
c
a\raisebox{0.25em}{b}c
abc a\raisebox{0.25em}{b}c |
u
o
_u^o
uo _u^o |
=
!
\underset{!}{=}
!= \underset{!}{=} |
∑
0
<
i
<
m
0
<
j
<
n
\sum\limits_{\substack{0<i<m\\0<j<n}}
0<i<m0<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 abac
重叠和间距
第一列 | 第二列 |
---|---|
=
/
{=}\mathllap{/\,}
=/ {=}\mathllap{/\,} |
(
x
2
)
\left(x^{\smash{2}}\right)
(x2) \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∑xij \sum_{\mathclap{1\le i\le j\le n}} x_{ij}
KaTeX
\KaTeX
KATEX同样支持\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,这样i*j*k
离运算符较远。但是当我们用了这些指令,就可以自动缩小这个距离。
∑ 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 \frac{3}{18} 183 e m \rm em em [ 11 ] ^{[11]} [11] 的间距 | \kern{distance} | 宽度为distance 的间距 |
\thinspace | 3 18 \frac{3}{18} 183 e m \rm em em 的间距 | \mkern{distance} | 宽度为distance 的间距 |
\> | 4 18 \frac{4}{18} 184 e m \rm em em 的间距 | \mskip{distance} | 宽度为distance 的间距 |
\: | 4 18 \frac{4}{18} 184 e m \rm em em 的间距 | \hskip{distance} | 宽度为distance 的间距 |
\medspace | 4 18 \frac{4}{18} 184 e m \rm em em 的间距 | \hspace{distance} | 宽度为distance 的间距 |
\; | 5 18 \frac{5}{18} 185 e m \rm em em 间距 | \hspace*{distance} | 宽度为distance 的间距 |
\thickspace | 5 18 \frac{5}{18} 185 e m \rm em em 间距 | \phantom{content} | 长与高等于参数的间距 |
\enspace | 1 2 \frac{1}{2} 21 e m \rm em em 间距 | \hphantom{content} | 高度等于参数的间距 |
\quad | 1 1 1 e m \rm em em 间距 | \vphantom{content} | 高度等于参数的间距 |
\qquad | 2 2 2 e m \rm em em 间距 | \! | – 3 18 \frac{3}{18} 183 e m \rm em em 间距 |
~ | 不换行间距 | \negthinspace | – 3 18 \frac{3}{18} 183 e m \rm em em 间距 |
\<space> | 间距 | \negmedspace | – 4 18 \frac{4}{18} 184 e m \rm em em 间距 |
\nobreakspace | 不换行间距 | \negthickspace | – 5 18 \frac{5}{18} 185 e m \rm em em 间距 |
\space | 普通的空格 |
[ 11 ] : [11]: [11]: 有关单位,请参考下方的“单位”一段。
提示
distance
参数可以接受任何
KaTeX
\KaTeX
KATEX的单位。
\kern
,\mkern
,\mskip
和\hspace
都可以直接加上距离参数,例如,\kern1em
可以生成一个宽度为
1
e
m
\rm 1em
1em的空格。
\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 x^2+x^2 x2+x2 | \def\foo{x^2} \foo + \foo |
y 2 + y 2 y^2+y^2 y2+y2 | \gdef\bar#1{#1^2} \bar{y} + \bar{y} |
\global\def\名称#1#2…{定义} | |
\newcommand\名称[参数数量]{定义} | |
\renewcommand\名称[参数数量]{定义} | |
\providecommand\名称[参数数量]{定义} |
你同样可以在 KaTeX \KaTeX KATEX的渲染选项中定义宏。 [ 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
,可以简化代码,也可以嵌套。
可能有人不怎么清楚宏定义的具体用法,这里举个栗子:
假设我们有一段代码:
Hello world!! Hello world!! Hello world!! \color{red}{\text{Hello world!!}}\\ \color{red}{\text{Hello world!!}}\\ \color{red}{\text{Hello world!!}}\\ Hello world!!Hello world!!Hello world!!
$$
\color{red}{\text{Hello world!!}}\\
\color{red}{\text{Hello world!!}}\\
\color{red}{\text{Hello world!!}}\\
$$
但是这样非常麻烦,所以我们可以用宏定义简化一下。
KaTeX parse error: Expected a control sequence at position 6: \def{̲\HelloWorld}{\c…
$$
\def{\HelloWorld}{\color{red}{\text{Hello world!!}}\\}
\HelloWorld\HelloWorld\HelloWorld
$$
顺带解释一下一些细节。
-
\def,\newcommand
之类都可以直接加自定义指令的名称,而不需要加括号。比如\def\kkksc03{AK IOI!}
。 -
\gdef,\global\def
用处比较诡异,一般用不到。和\def
的区别是,\def
如果在一定嵌套中定义,只能用在有限的定义域内。而\gdef
一类相当于直接在全局定义。可能有点模糊,这里举个栗子:{\def\t{2333} \t}
这句话定义后的\t
只能在括号中使用,比如{\def\t{2333} \t}
。而括号外会失效。{\def\t{2333}} \t
会渲染失败。而如果使用\gdef
一类,就会作用于“全局”。{\gdef\t{2333}} \t
成功渲染。 -
关于下面三个
command
的关系:\newcommand
是定义一个新的指令,如果已经有同名指令,就会渲染失败。\renewcommand
是重新定义指令。但是如果原来没有这个指令,也会渲染失败(迷惑行为)。\providecommand
综合了上面两个指令的缺点,满足如果原来没有这个指令,就会定义一个;否则重新定义。(更迷惑了好不好)。 -
关于覆写的问题:正如上面提到的,
\def
与\command
系列一样,只能作用于一定范围内,因此覆写的效果仅支持于这个范围。但是,如果将这些指令放在代码开头,就相当于全局定义了。\gdef
范围更广。\newcommand
不支持覆写;\renewcommand
只支持覆写;\providecommand
和\def
都支持覆写。 -
关于多参数:首先, KaTeX \KaTeX KATEX不支持不定参。然后,
\def
系列的参数可以这样定义:\def{\qwq}#1#2#3{#1+#2+#3=?}
要强调的是,参数只能从#1
开始排列,并且递增。比如,你要⑨个参数,只能这样写:\def{\名称}#1#2#3#4#5#6#7#8#9{定义}
(非常迷惑)。而command
系列相对方便,\newcommand{\名称}[参数数量]{定义}
就可以了。 -
(总结:遇事不决用
\def
,全局定义用\def
,多参数还能用\def
,)\def
天下第一
[
13
]
:
[13]:
[13]: 解释一下\makeatletter
指令:因为部分原因,我们在
TeX
\TeX
TEX中无法使用@
作为指令名称,除非使用这个指令。而
KaTeX
\KaTeX
KATEX中的@
则不需要,所以说“就像你使用了\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 |
当然,你也可以直接输入这些: ∫ ∬ ∭ ∮ ∏ ∐ ∑ ⋀ ⋁ ⋂ ⋃ ⨀ ⨁ ⨂ ⨄ ⨆ ∫∬∭∮∏∐∑⋀⋁⋂⋃⨀⨁⨂⨄⨆ ∫∬∭∮∏∐∑⋀⋁⋂⋃⨀⨁⨂⨄⨆
[ 14 ] : [14]: [14]: 这里的巨型运算符在居中情况下自动变大,都支持上下标摆放在上下两侧。
二元运算符
第一列 | 第二列 | 第三列 | 第四列 |
---|---|---|---|
+
+
+ + |
⋅
\cdot
⋅ \cdot |
⋗
\gtrdot
⋗ \gtrdot |
x
(
m
o
d
a
)
x \pmod a
x(moda) x \pmod a |
−
-
− - |
⋅
\cdotp
⋅ \cdotp |
⊺
\intercal
⊺ \intercal |
x
(
a
)
x \pod a
x(a) x \pod a |
/
/
/ / |
⋅
\centerdot
⋅ \centerdot |
∧
\land
∧ \land |
⊳
\rhd
⊳ \rhd |
∗
*
∗ * |
∘
\circ
∘ \circ |
⋋
\leftthreetimes
⋋ \leftthreetimes |
⋌
\rightthreetimes
⋌ \rightthreetimes |
⨿
\amalg
⨿ \amalg |
⊛
\circledast
⊛ \circledast |
.
\ldotp
. \ldotp |
⋊
\rtimes
⋊ \rtimes |
&
\And
& \And |
⊚
\circledcirc
⊚ \circledcirc |
∨
\lor
∨ \lor |
∖
\setminus
∖ \setminus |
∗
\ast
∗ \ast |
⊝
\circleddash
⊝ \circleddash |
⋖
\lessdot
⋖ \lessdot |
∖
\smallsetminus
∖ \smallsetminus |
⊼
\barwedge
⊼ \barwedge |
⋓
\Cup
⋓ \Cup |
⊲
\lhd
⊲ \lhd |
⊓
\sqcap
⊓ \sqcap |
◯
\bigcirc
◯ \bigcirc |
∪
\cup
∪ \cup |
⋉
\ltimes
⋉ \ltimes |
⊔
\sqcup
⊔ \sqcup |
m
o
d
\bmod
mod \bmod |
⋎
\curlyvee
⋎ \curlyvee |
x
m
o
d
a
x \mod a
xmoda x\mod a |
×
\times
× \times |
⊡
\boxdot
⊡ \boxdot |
⋏
\curlywedge
⋏ \curlywedge |
∓
\mp
∓ \mp |
⊴
\unlhd
⊴ \unlhd |
⊟
\boxminus
⊟ \boxminus |
÷
\div
÷ \div |
⊙
\odot
⊙ \odot |
⊵
\unrhd
⊵ \unrhd |
⊞
\boxplus
⊞ \boxplus |
⋇
\divideontimes
⋇ \divideontimes |
⊖
\ominus
⊖ \ominus |
⊎
\uplus
⊎ \uplus |
⊠
\boxtimes
⊠ \boxtimes |
∔
\dotplus
∔ \dotplus |
⊕
\oplus
⊕ \oplus |
∨
\vee
∨ \vee |
∙
\bullet
∙ \bullet |
⩞
\doublebarwedge
⩞ \doublebarwedge |
⊗
\otimes
⊗ \otimes |
⊻
\veebar
⊻ \veebar |
⋒
\Cap
⋒ \Cap |
⋒
\doublecap
⋒ \doublecap |
⊘
\oslash
⊘ \oslash |
∧
\wedge
∧ \wedge |
∩
\cap
∩ \cap |
⋓
\doublecup
⋓ \doublecup |
±
\pm
± \pm 或者\plusmn |
≀
\wr
≀ \wr |
当然,你也可以直接输入这些: + − / ∗ ⋅ ± × ÷ ∓ ∔ ∧ ∨ ∩ ∪ ≀ ⊎ ⊓ ⊔ ⊕ ⊖ ⊗ ⊘ ⊙ ⊚ ⊛ ⊝ +−/∗⋅±×÷∓∔∧∨∩∪≀⊎⊓⊔⊕⊖⊗⊘⊙⊚⊛⊝ +−/∗⋅±×÷∓∔∧∨∩∪≀⊎⊓⊔⊕⊖⊗⊘⊙⊚⊛⊝
分数和二项式
第一列 | 第二列 | 第三列 |
---|---|---|
a
b
\frac{a}{b}
ba \frac{a}{b} |
a
b
\tfrac{a}{b}
ba \tfrac{a}{b}
[
15
]
^{[15]}
[15] |
(
a
a
+
1
]
\genfrac(]{2pt}{1}a{a+1}
(a+1a] \genfrac (]{2pt}{1}a{a+1} |
a
b
{a \over b}
ba {a \over b} |
a
b
\dfrac{a}{b}
ba \dfrac{a}{b} |
a
b
+
1
{a\above{2pt}b+1}
b+1a {a \above{2pt} b+1} |
a
1
+
1
b
\cfrac{a}{1+\cfrac{1}{b}}
1+b1a \cfrac{a}{1 +\cfrac{1}{b}} | ||
(
n
k
)
\binom{n}{k}
(kn) \binom{n}{k} |
(
n
k
)
\dbinom{n}{k}
(kn) \dbinom{n}{k} |
{
n
k
}
{n\brace k}
{kn} {n\brace k} |
(
n
k
)
{n \choose k}
(kn) {n \choose k} |
(
n
k
)
\tbinom{n}{k}
(kn) \tbinom{n}{k} |
[
n
k
]
{n\brack k}
[kn] {n\brack k} |
[
15
]
:
[15]:
[15]: 在洛谷讨论区的
KaTeX
\KaTeX
KATEX版本中,有个
B
u
g
\rm Bug
Bug:嵌套使用\tfrac{}{}
会导致字体膨胀。
数学运算符
第一列 | 第二列 | 第三列 | 第四列 |
---|---|---|---|
arcsin
\arcsin
arcsin \arcsin |
cotg
\cotg
cotg \cotg |
ln
\ln
ln \ln |
det
\det
det \det |
arccos
\arccos
arccos \arccos |
coth
\coth
coth \coth |
log
\log
log \log |
gcd
\gcd
gcd \gcd |
arctan
\arctan
arctan \arctan |
csc
\csc
csc \csc |
sec
\sec
sec \sec |
inf
\inf
inf \inf |
arctg
\arctg
arctg \arctg |
ctg
\ctg
ctg \ctg |
sin
\sin
sin \sin |
lim
\lim
lim \lim |
arcctg
\arcctg
arcctg \arcctg |
cth
\cth
cth \cth |
sinh
\sinh
sinh \sinh |
lim inf
\liminf
liminf \liminf |
arg
\arg
arg \arg |
deg
\deg
deg \deg |
sh
\sh
sh \sh |
lim sup
\limsup
limsup \limsup |
ch
\ch
ch \ch |
dim
\dim
dim \dim |
tan
\tan
tan \tan |
max
\max
max \max |
cos
\cos
cos \cos |
exp
\exp
exp \exp |
tanh
\tanh
tanh \tanh |
min
\min
min \min |
cosec
\cosec
cosec \cosec |
hom
\hom
hom \hom |
tg
\tg
tg \tg |
Pr
\Pr
Pr \Pr |
cosh
\cosh
cosh \cosh |
ker
\ker
ker \ker |
th
\th
th \th |
sup
\sup
sup \sup |
cot
\cot
cot \cot |
lg
\lg
lg \lg |
arg max
\argmax
argmax \argmax |
arg min
\argmin
argmin \argmin |
plim
\plim
plim \plim |
f
\operatorname{f}
f \operatorname{f} |
f
\operatorname*{f}
f \operatorname*{f} |
参数显示在右侧的公式,如
∑
i
=
1
n
\sum_{i=1}^{n}
∑i=1n可以使用\limits
强行显示在上下侧,
∑
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}
3x \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}
overunder \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}
overunder。
[ 16 ] : [16]: [16]: 这里扩展箭头指箭头上下方可以放置文字,且箭头长度随文字长度的增加而增加。
样式,颜色,大小和字体
类的分配 [ 17 ] ^{[17]} [17]
\mathbin
\mathclose
\mathinner
\mathop
\mathopen
\mathord
\mathpunct
\mathrel
颜色
F
=
m
a
\color{blue} F=ma
F=ma \color{blue} F=ma
请注意,
KaTeX
\KaTeX
KATEX 中的\color
的作用类似于开关,使用后一定范围内所有的字体都会改变颜色。这与
LaTeX
\LaTeX
LATEX一致,但是与
M
a
t
h
J
a
x
\rm MathJax
MathJax不同。而
KaTeX
\KaTeX
KATEX得其他颜色指令中,它的颜色和内容都是参数;
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
\KaTeX
KATEX颜色函数将接受标准的
H
T
M
L
\rm HTML
HTML预定义颜色名称。他们还将接受
C
S
S
\rm CSS
CSS十六进制样式的
R
G
B
\rm RGB
RGB参数,比如#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字体没有粗体字形,你可以使用\pmb
指令可以模拟一个。例如,\pmb{\ mu}
呈现为:
μ
\pmb{\mu}
μ。(所以莫反一类文章的大量希腊字母粗体都可以用这种方法生成——编者注)。
大小
第一列 | 第二列 |
---|---|
A
B
\Huge AB
AB \Huge AB |
A
B
\normalsize AB
AB \normalsize AB |
A
B
\huge AB
AB \huge AB |
A
B
\small AB
AB \small AB |
A
B
\LARGE AB
AB \LARGE AB |
A
B
\footnotesize AB
AB \footnotesize AB |
A
B
\Large AB
AB \Large AB |
A
B
\scriptsize AB
AB \scriptsize AB |
A
B
\large AB
AB \large AB |
A
B
\tiny AB
AB \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=1n | \textstyle\sum_{i=1}^n |
x \scriptstyle x x | \scriptstyle x (The size of a first sub/superscript) |
x \scriptscriptstyle x x | \scriptscriptstyle x (The size of subsequent sub/superscripts) |
lim x \lim\limits_x xlim | \lim\limits_x |
lim x \lim\nolimits_x limx | \lim\nolimits_x |
x^2 \verb!x^2! x^2 | \verb!x^2!
[
19
]
^{[19]}
[19] |
在居中的环境下(即在$$ $$
当中),在\text{}
里面可以放置$...$
用来显示数学模式。
[
19
]
:
[19]:
[19]: \verb
以两个感叹号作为括号,里面可以填充任意文字。使用等宽字体(打字机字体)。
符号和标点
第一列 | 第二列 | 第三列 |
---|---|---|
% 注释
% 注释 |
…
\dots
… \dots |
KaTeX
\KaTeX
KATEX \KaTeX |
%
\%
% \% |
⋯
\cdots
⋯ \cdots |
LaTeX
\LaTeX
LATEX \LaTeX |
#
\#
# \# |
⋱
\ddots
⋱ \ddots |
TeX
\TeX
TEX \TeX |
&
\&
& \& |
…
\ldots
… \ldots |
∇
\nabla
∇ \nabla |
KaTeX parse error: Expected group after '_' at position 3: \__̲ \_ |
⋮
\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 Markdown
Markdown制表问题,无法显示字符`。这里的显示效果就是
‘
\lq
‘,同\lq
。
单位
在 KaTeX \KaTeX KATEX中,单位与在 TeX \TeX TEX中一样按比例进行处理。
但是很多地方, KaTeX \KaTeX KATEX单位不同于 C S S \rm CSS CSS单位。
KaTeX单位 \text{\KaTeX 单位} KATEX单位 | 备注 \text{备注} 备注 | KaTeX单位 \text{\KaTeX 单位} KATEX单位 | 备注 \text{备注} 备注 |
---|---|---|---|
em \text{em} em | CSS em \text{CSS em} CSS em | bp \text{bp} bp | 1/72 inch × F × G \text{1/72 inch × F × G} 1/72 inch × F × G |
ex \text{ex} ex | CSS ex \text{CSS ex} CSS ex | pc \text{pc} pc | 12 KaTeXpt \text{12 \KaTeX pt} 12 KATEXpt |
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 KATEXpt |
pt \text{pt} pt | 1/72.27 inch × F × G \text{1/72.27 inch × F × G} 1/72.27 inch × F × G | cc \text{cc} cc | 14856/1157 KaTeXpt \text{14856/1157 \KaTeX pt} 14856/1157 KATEXpt |
mm \text{mm} mm | 1 mm × F × G \text{1 mm × F × G} 1 mm × F × G | nd \text{nd} nd | 685/642 KaTeXpt \text{685/642 \KaTeX pt} 685/642 KATEXpt |
cm \text{cm} cm | 1 cm × F × G \text{1 cm × F × G} 1 cm × F × G | nc \text{nc} nc | 1370/107 KaTeXpt \text{1370/107 \KaTeX pt} 1370/107 KATEXpt |
in \text{in} in | 1 inch × F × G \text{1 inch × F × G} 1 inch × F × G | sp \text{sp} sp | 1/65536 KaTeXpt \text{1/65536 \KaTeX pt} 1/65536 KATEXpt |
其中,
-
F = F= F=(围绕着 H T M L \rm HTML HTML文字的字体大小)/( 10 p t \rm 10 pt 10pt)
-
G G G默认情况下为 1.21 1.21 1.21,因为 KaTeX \KaTeX KATEX字体大小通常为 1.21 × 1.21\times 1.21×周围字体大小。 H T M L \rm HTML HTML网页的 C S S \rm CSS CSS可以覆盖此值。
样式和大小的影响范围:
单位 | 文本模式 | s c r i p t \rm script script大小 [ 21 ] ^{[21]} [21] | h u g e \rm huge huge大小 |
---|---|---|---|
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} | \huge\rule{10pt}{10pt} |
[
21
]
:
[21]:
[21]: 这里不确定如何翻译scriptscript
和huge
。
本文全部译自 KaTeX \KaTeX KATEX官网。