Make large fractions actually work

Summary:
Also, rename it to '\dfrac', because it's more like a display fraction

Auditors: spicyj
This commit is contained in:
Emily Eisenberg 2013-07-07 22:41:22 -07:00
parent 2643f72a9d
commit f97aad13b7
4 changed files with 10 additions and 5 deletions

View File

@ -51,8 +51,8 @@ var buildGroup = function(group, prev) {
return makeSpan("mopen", textit(group.value));
} else if (group.type === "close") {
return makeSpan("mclose", textit(group.value));
} else if (group.type === "frac") {
var numer = makeSpan("mfracnum", buildExpression(group.value.numer, numer));
} else if (group.type === "dfrac") {
var numer = makeSpan("mfracnum", makeSpan("", buildExpression(group.value.numer, numer)));
var mid = makeSpan("mfracmid", makeSpan());
var denom = makeSpan("mfracden", buildExpression(group.value.denom, denom));

View File

@ -13,7 +13,7 @@ var normals = [
];
var funcs = [
'cdot', 'frac', 'lvert', 'rvert', 'pm', 'div'
'cdot', 'dfrac', 'lvert', 'rvert', 'pm', 'div'
];
var anyFunc = new RegExp("^\\\\(" + funcs.join("|") + ")(?![a-zA-Z])");

View File

@ -48,8 +48,8 @@ func
{$$ = [{type: 'bin', value: yytext}];}
| 'div'
{$$ = [{type: 'bin', value: yytext}];}
| 'frac' group group
{$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];}
| 'dfrac' group group
{$$ = [{type: 'dfrac', value: {numer: $2, denom: $3}}];}
| 'lvert'
{$$ = [{type: 'open', value: yytext}];}
| 'rvert'

View File

@ -104,3 +104,8 @@ input {
height: 0.05em;
min-height: 1px;
}
.mfracnum > span {
display: inline-block;
vertical-align: bottom;
}