Add \gt and \lt

This commit is contained in:
Marco Neumann 2015-09-28 16:52:41 +02:00
parent fdbdb28617
commit 95e568ed6b
4 changed files with 19 additions and 8 deletions

View File

@ -339,7 +339,7 @@ var stackAlwaysDelimiters = [
// and delimiters that never stack
var stackNeverDelimiters = [
"<", ">", "\\langle", "\\rangle", "/", "\\backslash"
"<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"
];
// Metrics of the different sizes. Found by looking at TeX's output of
@ -352,9 +352,9 @@ var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
*/
var makeSizedDelim = function(delim, size, options, mode) {
// < and > turn into \langle and \rangle in delimiters
if (delim === "<") {
if (delim === "<" || delim === "\\lt") {
delim = "\\langle";
} else if (delim === ">") {
} else if (delim === ">" || delim === "\\gt") {
delim = "\\rangle";
}
@ -468,9 +468,9 @@ var traverseSequence = function(delim, height, sequence, options) {
* traverse the sequences, and create a delimiter that the sequence tells us to.
*/
var makeCustomSizedDelim = function(delim, height, center, options, mode) {
if (delim === "<") {
if (delim === "<" || delim === "\\lt") {
delim = "\\langle";
} else if (delim === ">") {
} else if (delim === ">" || delim === "\\gt") {
delim = "\\rangle";
}

View File

@ -224,7 +224,7 @@ var delimiters = [
"(", ")", "[", "\\lbrack", "]", "\\rbrack",
"\\{", "\\lbrace", "\\}", "\\rbrace",
"\\lfloor", "\\rfloor", "\\lceil", "\\rceil",
"<", ">", "\\langle", "\\rangle",
"<", ">", "\\langle", "\\rangle", "\\lt", "\\gt",
"\\lvert", "\\rvert", "\\lVert", "\\rVert",
"\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache",
"/", "\\backslash",

View File

@ -487,6 +487,7 @@ defineSymbol(math, main, rel, "\u2245", "\\cong");
defineSymbol(math, main, rel, "\u2265", "\\ge");
defineSymbol(math, main, rel, "\u2265", "\\geq");
defineSymbol(math, main, rel, "\u2190", "\\gets");
defineSymbol(math, main, rel, ">", "\\gt");
defineSymbol(math, main, rel, "\u2208", "\\in");
defineSymbol(math, main, rel, "\u2209", "\\notin");
defineSymbol(math, main, rel, "\u2282", "\\subset");
@ -499,6 +500,7 @@ defineSymbol(math, main, rel, "\u22a8", "\\models");
defineSymbol(math, main, rel, "\u2190", "\\leftarrow");
defineSymbol(math, main, rel, "\u2264", "\\le");
defineSymbol(math, main, rel, "\u2264", "\\leq");
defineSymbol(math, main, rel, "<", "\\lt");
defineSymbol(math, main, rel, "\u2260", "\\ne");
defineSymbol(math, main, rel, "\u2260", "\\neq");
defineSymbol(math, main, rel, "\u2192", "\\rightarrow");

View File

@ -1248,7 +1248,7 @@ describe("A font parser", function () {
it("should not parse a series of font commands", function () {
expect("\\mathbb \\mathrm R").toNotParse();
});
it("should nest fonts correctly", function () {
var bf = getParsed("\\mathbf{a\\mathrm{b}c}")[0];
expect(bf.value.type).toMatch("font");
@ -1259,7 +1259,7 @@ describe("A font parser", function () {
expect(bf.value.body.value[1].value.font).toMatch("mathrm");
expect(bf.value.body.value[2].value).toMatch("c");
});
it("should have the correct greediness", function() {
expect("e^\\mathbf{x}").toParse();
});
@ -1752,3 +1752,12 @@ describe("A parser that does not throw on unsupported commands", function() {
expect(parsedInput[0].value.color).toBe(errorColor);
});
});
describe("The symbol table integraty", function() {
it("should treat certain symbols as synonyms", function() {
expect(getBuilt("<")).toEqual(getBuilt("\\lt"));
expect(getBuilt(">")).toEqual(getBuilt("\\gt"));
expect(getBuilt("\\left<\\frac{1}{x}\\right>"))
.toEqual(getBuilt("\\left\\lt\\frac{1}{x}\\right\\gt"));
});
});