版本比较
KaTeX & LaTeX.
正文
增加 8 行删除 8 行
12344567834 行未改动43444546474748495051525354555657565758596061106 行未改动全部展开16816917017117217217317417517689 行未改动266267268269270270271272273274111 行未改动全部展开386387388389390390391392393394162 行未改动全部展开557558559560561561562563564565124 行未改动全部展开前言---
由于在洛谷,有很多人对于 $\KaTeX$ 和 $\LaTeX$ 之间的关系并不清楚,导致很多人去搜 $\LaTeX$ 的资料,然后发现有许多指令无法在洛谷运行。 由于在洛谷,有很多人对于 $\KaTeX$ 和 $\LaTeX$ 之间的关系并不清楚,导致很多人去搜 $\LaTeX$ 的资料,然后发现有许多指令无法在洛谷运行。
但是事实上,$\KaTeX$ 才是洛谷上的 $\LaTeX$ 的渲染机制。因此只有 $\KaTeX$ 支持的指令才能正常使用。在 $\KaTeX$ 官网,其实有两张支持表,这里搬运过来以便于大家能够正确使用指令。
这张表应该涵盖了纯 $\KaTeX$ **所有**的功能。当然,$\LaTeX$ 公式大全亦可作为部分参考。下面是搬运部分。34 行未改动硬换行符是 $\begin{aligned}&\tt\backslash\backslash\\\end{aligned}$ 和 $\begin{aligned}&\tt\backslash newline \\\end{aligned}$。
在数学模式中,$\KaTeX$ 不会自动插入换行符。但是当渲染选项 $\text{strict}$ 设置为 $\text{true}$ 时,它将忽略显示数学模式并且插入硬换行。
注:软换行换行不换段,硬换行换行也换段。简单来说,$\KaTeX$有时会自动换行,但换行之后仍在同一段,也就是软换行。而硬换行之后,两部分内容就分离了。 注:软换行换行不换段,硬换行换行也换段。简单来说,$\KaTeX$有时会自动换行,但换行之后仍在同一段,也就是软换行。而硬换行之后,两部分内容就分离了。
### 垂直布局
| 显示效果 | $\KaTeX$ | 显示效果 | $\KaTeX$ ||:-|:-|:-|:-|| $x_n$ | $\begin{aligned}&\tt x\_n\\\end{aligned}$ | $\stackrel{!}{=}$ | $\begin{aligned}&\tt\backslash stackrel\{!\}\{=\}\\\end{aligned}$ || $a \atop b$ | $\begin{aligned}&\tt a \backslash atop \ b\\\end{aligned}$ | $_u^o$ | $\begin{aligned}&\tt \_u\text{\textasciicircum}o\\\end{aligned}$ || $e^x$ | $\begin{aligned}&\tt e\text{\textasciicircum}x\\\end{aligned}$ | $\overset{!}{=}$ | $\begin{aligned}&\tt\backslash overset\{!\}\{=\}\\\end{aligned}$ || $a\raisebox{0.25em}{b}c$ | $\begin{aligned}&\tt a\backslash raisebox\{0.25em\}\{b\}c\\\end{aligned}$ | $\sum\limits_{\substack{0<i<m\\0<j<n}}$ | $\begin{aligned}&\tt\backslash sum\_\{\backslash substack\{0<i<m\backslash\backslash0<j<n\}\}\\\end{aligned}$ | | $\underset{!}{=}$ | $\begin{aligned}&\tt\backslash underset\{!\}{=}\\\end{aligned}$ | | $a\raisebox{0.25em}{b}c$ | $\begin{aligned}&\tt a\backslash raisebox\{0.25em\}\{b\}c\\\end{aligned}$ | $\sum\limits_{\substack{0<i<m\\0<j<n}}$ | $\begin{aligned}&\tt\backslash sum\_\{\backslash substack\{0<i<m\backslash\backslash0<j<n\}\}\\\end{aligned}$ || $\underset{!}{=}$ | $\begin{aligned}&\tt\backslash underset\{!\}{=}\\\end{aligned}$ |
如果 $\begin{aligned}&\tt\backslash raisebox\\\end{aligned}$ 的第二个参数嵌套在 $\begin{aligned}&\tt \text{\textdollar} \cdots \text{\textdollar} \\\end{aligned}$ 分隔符内,则可以包含数学运算符,当然前提是整个公式包括在 $\begin{aligned}&\tt \text{\textdollar} \text{\textdollar} \cdots \text{\textdollar} \text{\textdollar} \\\end{aligned}$ 当中。例如 $\begin{aligned}&\tt \text{\textdollar} \text{\textdollar} a\backslash raisebox\{0.25em\}\{\text{\textdollar}\backslash frac \ a \ b\text{\textdollar}\}c \text{\textdollar} \text{\textdollar} \\\end{aligned}$ 的显示效果为
$$a\raisebox{0.25em}{$\frac a b$}c$$106 行未改动全部展开| 第一列 | 第二列 | 第三列 | 第四列 | 第五列 ||:-|:-|:-|:-|:-|| $()$ | $\begin{aligned}&\tt ()\\\end{aligned}$ | $\lparen\rparen$ | $\begin{aligned}&\tt \lparen\rparen\\\end{aligned}$ | $⌈ ⌉$ | $\begin{aligned}&\tt ⌈ ⌉\\\end{aligned}$ | $\lceil \rceil$ | $\begin{aligned}&\tt \lceil rceil\\\end{aligned}$ | $\uparrow$ | $\begin{aligned}&\tt \uparrow\\\end{aligned}$ || $[ ]$ | $\begin{aligned}&\tt [ ]\\\end{aligned}$ | $\lbrack\rbrack$`\lbrack\rbrack\\\end{aligned}$ | $⌊ ⌋$ | $\begin{aligned}&\tt ⌊ ⌋\\\end{aligned}$ | $\lfloor\rfloor$ | $\begin{aligned}&\tt \lfloor\rfloor\\\end{aligned}$ | $\downarrow$ | $\begin{aligned}&\tt \downarrow\\\end{aligned}$ || $\{ \}$ | $\begin{aligned}&\tt \{ \}\\\end{aligned}$ | $\lbrace\rbrace$ | $\begin{aligned}&\tt \lbrace\rbrace\\\end{aligned}$ | $⎰⎱$ | $\begin{aligned}&\tt ⎰⎱\\\end{aligned}$ | $\lmoustache\rmoustache$ | $\begin{aligned}&\tt \lmoustache\rmoustache` | $\updownarrow$ | $\begin{aligned}&\tt \updownarrow\\\end{aligned}$ | | $\{ \}$ | $\begin{aligned}&\tt \{ \}\\\end{aligned}$ | $\lbrace\rbrace$ | $\begin{aligned}&\tt \lbrace\rbrace\\\end{aligned}$ | $⎰⎱$ | $\begin{aligned}&\tt ⎰⎱\\\end{aligned}$ | $\lmoustache\rmoustache$ | $\begin{aligned}&\tt \lmoustache\rmoustache` | $\updownarrow$ | $\begin{aligned}&\tt \updownarrow\\\end{aligned}$ || $⟨ ⟩$ | $\begin{aligned}&\tt ⟨ ⟩\\\end{aligned}$ | $\langle\rangle$`\langle\rangle\\\end{aligned}$ | $⟮ ⟯$ | $\begin{aligned}&\tt ⟮ ⟯\\\end{aligned}$ | $\lgroup\rgroup$ | $\begin{aligned}&\tt \lgroup\rgroup\\\end{aligned}$ | $\Uparrow$ | $\begin{aligned}&\tt \Uparrow\\\end{aligned}$ || $^{[3]}$ | $\begin{aligned}&\tt |\\\end{aligned}$ | $\vert$ | $\begin{aligned}&\tt \vert\\\end{aligned}$ | $┌ ┐$ | $\begin{aligned}&\tt ┌ ┐\\\end{aligned}$ | $\ulcorner\urcorner$ | $\begin{aligned}&\tt \ulcorner\urcorner\\\end{aligned}$ | $\Downarrow$ | $\begin{aligned}&\tt \Downarrow\\\end{aligned}$ || $\| $ | $\begin{aligned}&\tt \|\\\end{aligned}$ | $\Vert$ | $\begin{aligned}&\tt \Vert\\\end{aligned}$ | $└ ┘$ | $\begin{aligned}&\tt └ ┘\\\end{aligned}$ | $\llcorner\lrcorner$ | $\begin{aligned}&\tt \llcorner\lrcorner\\\end{aligned}$ | $\Updownarrow$ | $\begin{aligned}&\tt \Updownarrow\\\end{aligned}$ || $\lvert\rvert$`\lvert\rvert\\\end{aligned}$ | $\lVert\rVert$ | $\begin{aligned}&\tt \lVert\rVert\\\end{aligned}$ | $\begin{aligned}&\tt \left.`$^{[4]}$ | $\begin{aligned}&\tt \right.\\\end{aligned}$ | $\backslash$ | $\begin{aligned}&\tt \backslash\\\end{aligned}$ |89 行未改动\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`成功渲染。111 行未改动全部展开如果$\KaTeX$呈现模式的设置中,$\text{strict}$设置为了$\text{false}$或$\text{warn}$(默认),则$\KaTeX$将在文本和数学模式下接受所有$\text{Unicode}$字母。所有无法识别的字符将被视为它们以文本模式显示。这样可能会遇到使用系统字体以及使用不正确的垂直对齐方式的问题。
对于波斯语中的复合字符,我们正在开发为用户提供的插件。(虽然你可能不会使用它——编者注)
$[8]:$ 因为没怎么写过$\rm CSS$,所以可能说明上有一些问题。 $[8]:$ 因为没怎么写过$\rm CSS$,所以可能说明上有一些问题。
:::
Y162 行未改动全部展开$\leadsto$ | $\begin{aligned}&\tt \leadsto\\\end{aligned}$ | $\nLeftrightarrow$ | $\begin{aligned}&\tt \nLeftrightarrow\\\end{aligned}$ | $\upharpoonleft$ | $\begin{aligned}&\tt \upharpoonleft`$\leftarrow$ | $\begin{aligned}&\tt \leftarrow\\\end{aligned}$ | $\nrightarrow$ | $\begin{aligned}&\tt \nrightarrow\\\end{aligned}$ | $\upharpoonright$ | $\begin{aligned}&\tt \upharpoonright`$\Leftarrow$ | $\begin{aligned}&\tt \Leftarrow\\\end{aligned}$ | $\nRightarrow$ | $\begin{aligned}&\tt \nRightarrow\\\end{aligned}$ | $\upuparrows$ | $\begin{aligned}&\tt \upuparrows`$\leftarrowtail$ | $\begin{aligned}&\tt \leftarrowtail\\\end{aligned}$ | $\nwarrow$ | $\begin{aligned}&\tt \nwarrow`$\leftharpoondown$ | $\begin{aligned}&\tt \leftharpoondown\\\end{aligned}$ | $\Rarr$ | $\begin{aligned}&\tt \Rarr` $\leftharpoondown$ | $\begin{aligned}&\tt \leftharpoondown\\\end{aligned}$ | $\Rarr$ | $\begin{aligned}&\tt \Rarr`
你也可以直接输入这些:$ ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↚ ↛ ↞ ↠ ↢ ↣ ↦ ↩ ↪ ↫ ↬ ↭ ↮ ↰ ↱↶ ↷ ↺ ↻ ↼ ↽ ↾ ↾ ↿ ⇀ ⇁ ⇂ ⇃ ⇄ ⇆ ⇇ ⇈ ⇉ ⇊ ⇋ ⇌⇍ ⇎ ⇏ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇚ ⇛ ⇝ ⇠ ⇢ $
:::124 行未改动全部展开