\kern fixes, \hskip support, \TeX, \LaTeX, \KaTeX (#974)

* Refactor \kern, proper \mkern support, add \hskip

* Move \kern, \mkern into functions directory
* Add \hskip, \mskip support (but without supporting plus/minus)
* Properly separate \kern, \hskip from \mkern, \mskip.
  (The former work in both modes, and don't support mu units.
  The latter work only in math mode and only support mu units.)

* Render \kern etc. using MathML <mspace>

* Implement \TeX macro

* Implement \LaTeX

* New KaTeX logo \katex

* Rename hskip.js -> kern.js

* Tweak katex \kern to 0.16em

* \katex kern -.17em

* Compute A raise height in \LaTeX and \katex

* Switch mu unit errors to warnings

* LaTeX screenshot test

* Replace \KaTeX with macro definition

* Update screenshots with \KaTeX in them

* Fix font selection for \*TeX macros
This commit is contained in:
Erik Demaine
2017-11-27 14:40:38 -05:00
committed by Kevin Barabash
parent f6a377b91c
commit 7036eb85cd
32 changed files with 108 additions and 93 deletions

View File

@@ -1046,7 +1046,7 @@ describe("A rule parser", function() {
describe("A kern parser", function() {
const emKern = "\\kern{1em}";
const exKern = "\\kern{1ex}";
const muKern = "\\kern{1mu}";
const muKern = "\\mkern{1mu}";
const abKern = "a\\kern{1em}b";
const badUnitRule = "\\kern{1au}";
const noNumberRule = "\\kern{em}";
@@ -1082,10 +1082,10 @@ describe("A kern parser", function() {
describe("A non-braced kern parser", function() {
const emKern = "\\kern1em";
const exKern = "\\kern 1 ex";
const muKern = "\\kern 1mu";
const muKern = "\\mkern 1mu";
const abKern1 = "a\\mkern1mub";
const abKern2 = "a\\kern-1mub";
const abKern3 = "a\\kern-1mu b";
const abKern2 = "a\\mkern-1mub";
const abKern3 = "a\\mkern-1mu b";
const badUnitRule = "\\kern1au";
const noNumberRule = "\\kern em";
@@ -1137,7 +1137,7 @@ describe("A non-braced kern parser", function() {
});
it("should handle whitespace", function() {
const abKern = "a\\kern\t-\r1 \n mu\nb";
const abKern = "a\\mkern\t-\r1 \n mu\nb";
const abParse = getParsed(abKern);
expect(abParse.length).toEqual(3);