mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 20:28:38 +00:00
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:
18
MJLite.js
18
MJLite.js
@@ -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) {
|
||||
|
Reference in New Issue
Block a user