diff --git a/contrib/render-a11y-string/render-a11y-string.js b/contrib/render-a11y-string/render-a11y-string.js index 3ec0bc6f..b8432e4b 100644 --- a/contrib/render-a11y-string/render-a11y-string.js +++ b/contrib/render-a11y-string/render-a11y-string.js @@ -327,6 +327,11 @@ const handleObject = ( break; } + case "hbox": { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; + } + case "kern": { // No op: we don't attempt to present kerning information // to the screen reader. @@ -546,6 +551,11 @@ const handleObject = ( `KaTeX-a11y: enclose node with ${tree.label} not supported yet`); } + case "vcenter": { + buildA11yStrings(tree.body, a11yStrings, atomType); + break; + } + case "vphantom": { throw new Error("KaTeX-a11y: vphantom not implemented yet"); } diff --git a/contrib/render-a11y-string/test/render-a11y-string-spec.js b/contrib/render-a11y-string/test/render-a11y-string-spec.js index 7b547441..0900525a 100644 --- a/contrib/render-a11y-string/test/render-a11y-string-spec.js +++ b/contrib/render-a11y-string/test/render-a11y-string-spec.js @@ -272,6 +272,13 @@ describe("renderA11yString", () => { }); }); + describe("hbox", () => { + test("\\hbox", () => { + const result = renderA11yString("x+\\hbox{y}"); + expect(result).toMatchInlineSnapshot(`"x, plus, y"`); + }); + }); + describe("inner", () => { test("\\ldots", () => { const result = renderA11yString("\\ldots"); @@ -524,6 +531,13 @@ describe("renderA11yString", () => { }); }); + describe("vcenter", () => { + test("\\vcenter", () => { + const result = renderA11yString("x+\\vcenter{y}"); + expect(result).toMatchInlineSnapshot(`"x, plus, y"`); + }); + }); + describe("verb", () => { test("\\verb", () => { const result = renderA11yString("\\verb|hello|"); diff --git a/docs/support_table.md b/docs/support_table.md index 4ad5d8d2..3f038b21 100644 --- a/docs/support_table.md +++ b/docs/support_table.md @@ -456,7 +456,8 @@ use `\ce` instead| |\harr|$\harr$|| |\hat|$\hat{\theta}$|`\hat{\theta}`| |\hbar|$\hbar$|| -|\hbox|Not supported|| +|\hbox|$\hbox{$x^2$}$|`\hbox{$x^2$}`| +|\hbox to | Not supported || |\hdashline|$\begin{matrix}a&b\\ \hdashline c &d\end{matrix}$|`\begin{matrix}`
   `a & b \\`
   `\hdashline`
   `c & d`
`\end{matrix}`| |\hearts|$\hearts$|| |\heartsuit|$\heartsuit$|| @@ -865,7 +866,7 @@ use `\ce` instead| |\R|$\R$|| |\r|$\text{\r{a}}$|`\text{\r{a}}`| |\raise|Not supported|see `\raisebox`| -|\raisebox|$h\raisebox{2pt}{ighe}r$|`h\raisebox{2pt}{ighe}r`| +|\raisebox|$h\raisebox{2pt}{ighe}r$|`h\raisebox{2pt}{$ighe$}r`| |\rang|$\langle A\rang$|`\langle A\rang`| |\rangle|$\langle A\rangle$|`\langle A\rangle`| |\Rarr|$\Rarr$|| @@ -1176,8 +1177,9 @@ use `\ce` instead| |\vartriangleright|$\vartriangleright$|| |\varUpsilon|$\varUpsilon$|| |\varXi|$\varXi$|| -|\vcentcolon|$\vcentcolon$|| -|\vcenter|Not supported|| +|\vcentcolon|$\mathrel{\vcentcolon =}$|`\mathrel{\vcentcolon =}`| +|\vcenter|$a+\left(\vcenter{\frac{\frac a b}c}\right)$|`a+\left(\vcenter{\hbox{$\frac{\frac a b}c$}}\right)`
TeX (strict) syntax| +|\vcenter|$a+\left(\vcenter{\frac{\frac a b}c}\right)$|`a+\left(\vcenter{\frac{\frac a b}c}\right)`
non-strict syntax| |\Vdash|$\Vdash$|| |\vDash|$\vDash$|| |\vdash|$\vdash$|| diff --git a/docs/supported.md b/docs/supported.md index addae459..a5a2460b 100644 --- a/docs/supported.md +++ b/docs/supported.md @@ -236,11 +236,14 @@ In display math, KaTeX does not insert automatic line breaks. It ignores display |||| |:--------------|:----------------------------------------|:----- -|$x_n$ `x_n` |$\stackrel{!}{=}$ `\stackrel{!}{=}` |$a \atop b$ `a \atop b` -|$e^x$ `e^x` |$\overset{!}{=}$ `\overset{!}{=}` |$a\raisebox{0.25em}{b}c$ `a\raisebox{0.25em}{b}c` -|$_u^o $ `_u^o `|$\underset{!}{=}$ `\underset{!}{=}` | $$\sum_{\substack{0 { expect("a^2 + b^2 = c^2 % Pythagoras' Theorem\n").toParse(); diff --git a/test/screenshotter/images/CD-chrome.png b/test/screenshotter/images/CD-chrome.png new file mode 100644 index 00000000..7ea84ba4 Binary files /dev/null and b/test/screenshotter/images/CD-chrome.png differ diff --git a/test/screenshotter/images/CD-firefox.png b/test/screenshotter/images/CD-firefox.png new file mode 100644 index 00000000..0ada33c8 Binary files /dev/null and b/test/screenshotter/images/CD-firefox.png differ diff --git a/test/screenshotter/images/Raisebox-chrome.png b/test/screenshotter/images/Raisebox-chrome.png index 44af403b..b044954e 100644 Binary files a/test/screenshotter/images/Raisebox-chrome.png and b/test/screenshotter/images/Raisebox-chrome.png differ diff --git a/test/screenshotter/images/Raisebox-firefox.png b/test/screenshotter/images/Raisebox-firefox.png index c51b13a6..27ed8105 100644 Binary files a/test/screenshotter/images/Raisebox-firefox.png and b/test/screenshotter/images/Raisebox-firefox.png differ diff --git a/test/screenshotter/images/Raisebox-safari.png b/test/screenshotter/images/Raisebox-safari.png index 24fec33f..2fae73f3 100644 Binary files a/test/screenshotter/images/Raisebox-safari.png and b/test/screenshotter/images/Raisebox-safari.png differ diff --git a/test/screenshotter/ss_data.yaml b/test/screenshotter/ss_data.yaml index 8f4ea055..5f601b46 100644 --- a/test/screenshotter/ss_data.yaml +++ b/test/screenshotter/ss_data.yaml @@ -323,7 +323,11 @@ Phase: 120\text{V}\phase{-78.2^\circ}\;\Large\phase{78.2^\circ} Pmb: \mu\pmb{\mu}\pmb{=}\mu\pmb{+}\mu PrimeSpacing: f'+f_2'+f^{f'} PrimeSuper: x'^2+x'''^2+x'^2_3+x_3'^2 -Raisebox: \frac{a}{a\raisebox{0.5em}{b}} \cdot \frac{a\raisebox{-0.5em}{b}}{a} \cdot \sqrt{a\raisebox{0.5em}{b}} \cdot \sqrt{a\raisebox{-0.5em}{b}} \cdot \sqrt{a\raisebox{0.5em}{b}\raisebox{-0.5em}{b}} +Raisebox: + \begin{matrix} + \frac{a}{a\raisebox{0.5em}{b}} \cdot \frac{a\raisebox{-0.5em}{b}}{a} \cdot \sqrt{a\raisebox{0.5em}{b}} \cdot \sqrt{a\raisebox{-0.5em}{b}} \cdot \sqrt{a\raisebox{0.5em}{b}\raisebox{-0.5em}{b}} \\[2em] + a + \left(\vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}}\right) + \end {matrix} ReactionArrows: | \begin{matrix} A \xrightleftarrows{} B \xrightequilibrium{} C \xleftequilibrium{} D \\