Support absolute TeX units (#732)

* Support absolute TeX units

* Implement @kohler's comments

* Rewrite unit documentation according to @kohler's comments
This commit is contained in:
Erik Demaine
2017-08-12 07:30:06 +09:00
committed by Kevin Barabash
parent dcdca732a3
commit a0bedcce8e
9 changed files with 149 additions and 47 deletions

View File

@@ -931,7 +931,7 @@ describe("An overline parser", function() {
describe("A rule parser", function() {
const emRule = "\\rule{1em}{2em}";
const exRule = "\\rule{1ex}{2em}";
const badUnitRule = "\\rule{1px}{2em}";
const badUnitRule = "\\rule{1au}{2em}";
const noNumberRule = "\\rule{1em}{em}";
const incompleteRule = "\\rule{1em}";
const hardNumberRule = "\\rule{ 01.24ex}{2.450 em }";
@@ -988,7 +988,7 @@ describe("A kern parser", function() {
const exKern = "\\kern{1ex}";
const muKern = "\\kern{1mu}";
const abKern = "a\\kern{1em}b";
const badUnitRule = "\\kern{1px}";
const badUnitRule = "\\kern{1au}";
const noNumberRule = "\\kern{em}";
it("should list the correct units", function() {
@@ -1026,7 +1026,7 @@ describe("A non-braced kern parser", function() {
const abKern1 = "a\\mkern1mub";
const abKern2 = "a\\kern-1mub";
const abKern3 = "a\\kern-1mu b";
const badUnitRule = "\\kern1px";
const badUnitRule = "\\kern1au";
const noNumberRule = "\\kern em";
it("should list the correct units", function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -223,6 +223,21 @@ Symbols1: |
Text: \frac{a}{b}\text{c~ {ab} \ e}+fg
TextWithMath: \text{for $a < b$ and $ c < d $}.
Unicode: \begin{matrix}\text{ÀàÇçÉéÏïÖöÛû} \\ \text{БГДЖЗЙЛФЦШЫЮЯ} \\ \text{여보세요} \\ \text{私はバナナです} \end{matrix}
Units: |
\begin{array}{ll}
\mathrm H\kern 1em\mathrm H \text{\tiny (1em)}
& \mathrm H\kern 1ex\mathrm H \text{\tiny (1ex)} \\
\mathrm H{\scriptstyle \kern 1em}\mathrm H \text{\tiny (ss 1em)}
& \mathrm H{\scriptstyle \kern 1ex}\mathrm H \text{\tiny (ss 1ex)} \\
\mathrm H{\small \kern 1em}\mathrm H \text{\tiny (sm 1em)}
& \mathrm H{\small \kern 1ex}\mathrm H \text{\tiny (sm 1ex)} \\
\mathrm H\mkern 18mu\mathrm H \text{\tiny (18mu)}
& \mathrm H\kern 1cm\mathrm H \text{\tiny (1cm)} \\
\mathrm H{\scriptstyle \mkern 18mu}\mathrm H \text{\tiny (ss 18mu)}
& \mathrm H{\scriptstyle \kern 1cm}\mathrm H \text{\tiny (ss 1cm)} \\
\mathrm H{\small \mkern 18mu}\mathrm H \text{\tiny (sm 18mu)}
& \mathrm H{\small \kern 1cm}\mathrm H \text{\tiny (sm 1cm)}
\end{array}
UnsupportedCmds:
tex: \err\,\frac\fracerr3\,2^\superr_\suberr\,\sqrt\sqrterr
noThrow: 1