Add spacing functions

Summary: Add \qquad, \quad, \;, etc. Fixes T7

Test Plan:
Add some spacings. Make sure that they look reasonable widths.
Especially, if you add a space (`\space`), make sure that it doesn't disappear
because the spacing disappears.

Reviewers: spicyj

Reviewed By: spicyj

Maniphest Tasks: T7

Differential Revision: http://phabricator.benalpert.com/D46
This commit is contained in:
Emily Eisenberg
2013-07-09 15:32:54 -07:00
parent a30a39247f
commit 2478a385ae
4 changed files with 60 additions and 1 deletions

View File

@@ -66,6 +66,20 @@ var buildGroup = function(group, prev) {
return makeSpan("mord mfrac", [numer, mid, denom]);
} else if (group.type === "color") {
return makeSpan("mord " + group.value.color, buildExpression(group.value.value));
} else if (group.type === "spacing") {
if (group.value === "\\ " || group.value === "\\space") {
return makeSpan("mord mspace", textit(group.value));
} else {
var spacingClassMap = {
"\\qquad": "qquad",
"\\quad": "quad",
"\\;": "thickspace",
"\\:": "mediumspace",
"\\,": "thinspace"
};
return makeSpan("mord mspace " + spacingClassMap[group.value]);
}
} else {
console.log("Unknown type:", group.type);
}
@@ -83,7 +97,9 @@ var charLookup = {
"\\geq": "\u2265",
"\\neq": "\u2260",
"\\nleq": "\u2270",
"\\ngeq": "\u2271"
"\\ngeq": "\u2271",
"\\ ": "\u00a0",
"\\space": "\u00a0"
};
var textit = function(value) {