Add support for \aa, \AA, \lq, \rq, \lbrack, \rbrack (#1069)

* Add support for \aa, \AA, \lq, \rq, \lbrack, \rbrack

The lack of \aa and \AA was reported in #1066.  Added these
via simple macros, with supporting tests.  Also add \lq, \rq,
\lbrack, \rbrack as aliases for "`", "'", "[", "]" which were
in the same area of latex.ltx.

* removed duplicate comment
This commit is contained in:
Erik Demaine
2018-01-16 09:07:50 -08:00
committed by Kevin Barabash
parent 0599e09a2d
commit a32f82a8ea
2 changed files with 22 additions and 1 deletions

View File

@@ -96,12 +96,27 @@ defineMacro("\\TextOrMath", function(context) {
});
//////////////////////////////////////////////////////////////////////
// basics
// Grouping
// \let\bgroup={ \let\egroup=}
defineMacro("\\bgroup", "{");
defineMacro("\\egroup", "}");
defineMacro("\\begingroup", "{");
defineMacro("\\endgroup", "}");
// Symbols from latex.ltx:
// \def\lq{`}
// \def\rq{'}
// \def\lbrack{[}
// \def\rbrack{]}
// \def \aa {\r a}
// \def \AA {\r A}
defineMacro("\\lq", "`");
defineMacro("\\rq", "'");
defineMacro("\\lbrack", "[");
defineMacro("\\rbrack", "]");
defineMacro("\\aa", "\\r a");
defineMacro("\\AA", "\\r A");
// Unicode double-struck letters
defineMacro("\u2102", "\\mathbb{C}");
defineMacro("\u210D", "\\mathbb{H}");

View File

@@ -2798,6 +2798,12 @@ describe("Unicode accents", function() {
"\\'y\\\"y}");
});
it("should support \\aa in text mode", function() {
expect("\\text{\\aa\\AA}").toParseLike("\\text{\\r a\\r A}");
expect("\\aa").toNotParse();
expect("\\Aa").toNotParse();
});
it("should parse combining characters", function() {
expect("A\u0301C\u0301").toParseLike("Á\\acute C");
expect("\\text{A\u0301C\u0301}").toParseLike("\\text{Á\\'C}");