mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-11 14:08:42 +00:00
feat: Support {CD} (#2396)
* Support {CD} * Edit screenshotter test to fit on one page * Update screenshots * Remove bogus Safari screenshot * Edit documentation to avoid tag conflicts and explain delimiters * Add type annotations * Add bogus safari screenshot * Update with real Safari screenshot * Set label vertical alignment * Revise call to parseExpression() per PR 2085 changes to macro parsing * Update Firefox screenshot * Pick up review comments * Add unit tests and snapshot. * Tighten up label collection. * Better loop index * remove extra space * Picked up comments. Added a parse check. Added a test. Co-authored-by: ylemkimon <y@ylem.kim> Co-authored-by: Kevin Barabash <kevinb@khanacademy.org> Co-authored-by: Kevin Barabash <kevinb7@gmail.com>
This commit is contained in:
@@ -83,17 +83,24 @@ $( \big( \Big( \bigg( \Bigg($ `( \big( \Big( \bigg( \Bigg(`
|
||||
|$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ |`\begin{pmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{pmatrix}` |$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ | `\begin{bmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{bmatrix}`
|
||||
|$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$ |`\begin{vmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{vmatrix}` |$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$ |`\begin{Vmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{Vmatrix}`
|
||||
|$\begin{Bmatrix} a & b \\ c & d \end{Bmatrix}$ |`\begin{Bmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{Bmatrix}`|$\def\arraystretch{1.5}\begin{array}{c:c:c} a & b & c \\ \hline d & e & f \\ \hdashline g & h & i \end{array}$|`\def\arraystretch{1.5}`<br> `\begin{array}{c:c:c}`<br> `a & b & c \\ \hline`<br> `d & e & f \\`<br> `\hdashline`<br> `g & h & i`<br>`\end{array}`
|
||||
|$$\begin{equation}\begin{split}a &=b+c\\&=e+f\end{split}\end{equation}$$ |`\begin{equation}`<br>`\begin{split}` `a &=b+c\\`<br> `&=e+f`<br>`\end{split}`<br>`\end{equation}` |$$\begin{equation*}\begin{split}a &=b+c\\&=e+f\end{split}\end{equation*}$$ |`\begin{equation*}`<br>`\begin{split}` `a &=b+c\\`<br> `&=e+f`<br>`\end{split}`<br>`\end{equation*}`
|
||||
|$$\begin{align} a&=b+c \\ d+e&=f \end{align}$$ |`\begin{align}`<br> `a&=b+c \\`<br> `d+e&=f`<br>`\end{align}`|$$\begin{alignat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignat}$$ |
|
||||
|$$\begin{align*} a&=b+c \\ d+e&=f \end{align*}$$ |`\begin{align*}`<br> `a&=b+c \\`<br> `d+e&=f`<br>`\end{align*}`|$\begin{aligned} a&=b+c \\ d+e&=f \end{aligned}$ |`\begin{aligned}`<br> `a&=b+c \\`<br> `d+e&=f`<br>`\end{aligned}`|
|
||||
`\begin{alignedat}{2}`<br> `10&x+ &3&y = 2 \\`<br> ` 3&x+&13&y = 4`<br>`\end{alignedat}`|$\begin{alignedat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignedat}$ |`\begin{alignedat}{2}`<br> `10&x+ &3&y = 2 \\`<br> ` 3&x+&13&y = 4`<br>`\end{alignedat}`
|
||||
|$$\begin{gather} a=b \\ e=b+c \end{gather}$$ |`\begin{gather}`<br> `a=b \\ `<br> `e=b+c`<br>`\end{gather}`|$\begin{gathered} a=b \\ e=b+c \end{gathered}$ |`\begin{gathered}`<br> `a=b \\ `<br> `e=b+c`<br>`\end{gathered}`|
|
||||
|$x = \begin{cases} a &\text{if } b \\ c &\text{if } d \end{cases}$ |`x = \begin{cases}`<br> `a &\text{if } b \\`<br> `c &\text{if } d`<br>`\end{cases}`|$\begin{rcases} a &\text{if } b \\ c &\text{if } d \end{rcases}⇒…$ |`\begin{rcases}`<br> `a &\text{if } b \\`<br> `c &\text{if } d`<br>`\end{rcases}⇒…`|
|
||||
|$\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}$ | `\begin{smallmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{smallmatrix}` |||
|
||||
|$\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}$ | `\begin{smallmatrix}`<br> `a & b \\`<br> `c & d`<br>`\end{smallmatrix}` |$$\begin{CD}A @>a>> B \\@VbVV @AAcA\\C @= D\end{CD}$$ |`\begin{CD}`<br> `A @>a>> B \\`<br>`@VbVV @AAcA \\`<br> `C @= D`<br>`\\end{CD}`|
|
||||
|
||||
|||||
|
||||
|:---------------------|:---------------------|
|
||||
|$$\begin{align} a&=b+c \\ d+e&=f \end{align}$$ |`\begin{align}`<br> `a&=b+c \\`<br> `d+e&=f`<br>`\end{align}`
|
||||
|$$\begin{alignat}{2}10&x+&3&y=2\\3&x+&13&y=4\end{alignat}$$ |`\begin{alignedat}{2}`<br> `10&x+ &3&y = 2 \\`<br> ` 3&x+&13&y = 4`<br>`\end{alignedat}`
|
||||
|`\begin{equation}`<br>`\begin{split}` `a &=b+c\\`<br> `&=e+f`<br>`\end{split}`<br>`\end{equation}`
|
||||
|$$\begin{gather} a=b \\ e=b+c \end{gather}$$ |`\begin{gather}`<br> `a=b \\ `<br> `e=b+c`<br>`\end{gather}`
|
||||
|
||||
</div>
|
||||
|
||||
KaTeX also supports `darray`, `dcases`, and `drcases`, which apply `displaystyle`.
|
||||
KaTeX also supports:
|
||||
* `darray`, `dcases`, and `drcases`, which render in `displaystyle`
|
||||
* `align*`, `alignat*`, `gather*`, and `equation*`, which omit equation numbers
|
||||
* `aligned`, `alignedat`, and `gathered`, which LaTeX will render while in math mode
|
||||
|
||||
Environments `align`, `alignat`, `CD`, `equation`, and `gather` (and their starred versions) may be called from display mode. This usually means that they may be called from within `$$…$$` delimiters or `\[…\]` delimiters. They may not be called from within `$…$` or `\(…\)` delimiters. In the KaTeX auto-render extension, as in LaTeX, these environments are themselves are a way to change from text mode to math display mode, and `\[…\]` delimiters are not necessary.
|
||||
|
||||
And KaTeX supports `matrix*`, `pmatrix*`, `bmatrix*`, `Bmatrix*`, `vmatrix*`, and `Vmatrix*`, which take an optional argument to set column alignment, as in `\begin{matrix}[1]`, `\begin{matrix}[c]`, or `\begin{matrix}[r]`.
|
||||
|
||||
@@ -103,6 +110,8 @@ The `{array}` environment supports `|` and `:` vertical separators.
|
||||
|
||||
The `{array}` environment does not yet support `\cline` or `\multicolumn`.
|
||||
|
||||
`\tag` can not yet be applied to individual environment rows.
|
||||
|
||||
<div class="katex-hopscotch">
|
||||
|
||||
## HTML
|
||||
|
Reference in New Issue
Block a user