feat: Support \vcenter and \hbox (#2452)
* Support \vcenter, \raise, \lower, and \hbox * Update screenshots * Edit docs for strict and hbox to * Fix typo for \hbox to * Update Safari screenshot * Augment docs for \vcentcolon * Edit vcenter MathML comment. * Remove pointless class from vcenter MathML * Withdraw \raise and \lower * Updatae Chrome and Firefox screenshots * Update Safari screenshot * Delete allowedInArgument setting Co-authored-by: ylemkimon <y@ylem.kim> * Update Chrome and Firefox screenshots * Update Chrome and Firefox screenshots take 2 * Update screenshot Co-authored-by: ylemkimon <y@ylem.kim>
@@ -1642,6 +1642,36 @@ describe("A \\pmb builder", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("A raise parser", function() {
|
||||
it("should parse and build text in \\raisebox", function() {
|
||||
expect("\\raisebox{5pt}{text}").toBuild(strictSettings);
|
||||
expect("\\raisebox{-5pt}{text}").toBuild(strictSettings);
|
||||
});
|
||||
|
||||
it("should parse and build math in non-strict \\vcenter", function() {
|
||||
expect("\\vcenter{\\frac a b}").toBuild(nonstrictSettings);
|
||||
});
|
||||
|
||||
it("should fail to parse math in \\raisebox", function() {
|
||||
expect("\\raisebox{5pt}{\\frac a b}").not.toParse(nonstrictSettings);
|
||||
expect("\\raisebox{-5pt}{\\frac a b}").not.toParse(nonstrictSettings);
|
||||
});
|
||||
|
||||
it("should fail to parse math in an \\hbox", function() {
|
||||
expect("\\hbox{\\frac a b}").not.toParse(nonstrictSettings);
|
||||
});
|
||||
|
||||
it("should fail to build, given an unbraced length", function() {
|
||||
expect("\\raisebox5pt{text}").not.toBuild(strictSettings);
|
||||
expect("\\raisebox-5pt{text}").not.toBuild(strictSettings);
|
||||
});
|
||||
|
||||
|
||||
it("should build math in an hbox when math mode is set", function() {
|
||||
expect("a + \\vcenter{\\hbox{$\\frac{\\frac a b}c$}}").toBuild(strictSettings);
|
||||
});
|
||||
});
|
||||
|
||||
describe("A comment parser", function() {
|
||||
it("should parse comments at the end of a line", () => {
|
||||
expect("a^2 + b^2 = c^2 % Pythagoras' Theorem\n").toParse();
|
||||
|
BIN
test/screenshotter/images/CD-chrome.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
test/screenshotter/images/CD-firefox.png
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 16 KiB |
@@ -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 \\
|
||||
|