mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
Add llap and rlap
Summary: By the powers of Greyskull (and maybe css) we have vanquished the great and powerful llap! All hail! Test Plan: Add some \llap and \rlap. Make sure it's positioned correctly. Reviewers: spicyj Reviewed By: spicyj Differential Revision: http://phabricator.benalpert.com/D48
This commit is contained in:
@@ -80,6 +80,12 @@ var buildGroup = function(group, prev) {
|
|||||||
|
|
||||||
return makeSpan("mord mspace " + spacingClassMap[group.value]);
|
return makeSpan("mord mspace " + spacingClassMap[group.value]);
|
||||||
}
|
}
|
||||||
|
} else if (group.type === "llap") {
|
||||||
|
var inner = makeSpan("", buildExpression(group.value));
|
||||||
|
return makeSpan("llap", inner);
|
||||||
|
} else if (group.type === "rlap") {
|
||||||
|
var inner = makeSpan("", buildExpression(group.value));
|
||||||
|
return makeSpan("rlap", inner);
|
||||||
} else {
|
} else {
|
||||||
console.log("Unknown type:", group.type);
|
console.log("Unknown type:", group.type);
|
||||||
}
|
}
|
||||||
|
2
lexer.js
2
lexer.js
@@ -25,7 +25,7 @@ var funcs = [
|
|||||||
// Colors
|
// Colors
|
||||||
'blue', 'orange', 'pink', 'red', 'green', 'gray', 'purple',
|
'blue', 'orange', 'pink', 'red', 'green', 'gray', 'purple',
|
||||||
// Other functions
|
// Other functions
|
||||||
'dfrac'
|
'dfrac', 'llap', 'rlap'
|
||||||
];
|
];
|
||||||
var anyFunc = new RegExp("^\\\\(" + funcs.join("|") + ")(?![a-zA-Z])");
|
var anyFunc = new RegExp("^\\\\(" + funcs.join("|") + ")(?![a-zA-Z])");
|
||||||
|
|
||||||
|
@@ -90,6 +90,10 @@ func
|
|||||||
{$$ = [{type: 'color', value: {color: 'purple', value: $2}}];}
|
{$$ = [{type: 'color', value: {color: 'purple', value: $2}}];}
|
||||||
| 'dfrac' group group
|
| 'dfrac' group group
|
||||||
{$$ = [{type: 'dfrac', value: {numer: $2, denom: $3}}];}
|
{$$ = [{type: 'dfrac', value: {numer: $2, denom: $3}}];}
|
||||||
|
| 'llap' group
|
||||||
|
{$$ = [{type: 'llap', value: $2}];}
|
||||||
|
| 'rlap' group
|
||||||
|
{$$ = [{type: 'rlap', value: $2}];}
|
||||||
;
|
;
|
||||||
|
|
||||||
atom
|
atom
|
||||||
|
@@ -129,6 +129,20 @@ big parens
|
|||||||
width: 2em;
|
width: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.llap, .rlap {
|
||||||
|
width: 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.llap > span {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rlap > span {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.mord.blue { color: #6495ed; }
|
.mord.blue { color: #6495ed; }
|
||||||
.mord.orange { color: #ffa500; }
|
.mord.orange { color: #ffa500; }
|
||||||
|
Reference in New Issue
Block a user