Skip to content

Commit

Permalink
Replace named space with numeric em values for space commands.
Browse files Browse the repository at this point in the history
See #60
  • Loading branch information
fred-wang committed Mar 23, 2019
1 parent f5b1388 commit a0c0403
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions TeXZilla.jison
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ function newMo(aContent, aLeftSpace, aRightSpace) {
return tag;
}
function newSpace(aWidth) {
return "<mspace width=\"" + aWidth + "em\"/>";
}
function newScript(aUnderOver, aBase, aScriptBot, aScriptTop) {
/* Create a new MathML script element. */
if (aUnderOver) {
Expand Down Expand Up @@ -697,14 +701,14 @@ closedTerm
| SLASH closedTerm {
$$ = newTag("menclose", $2, "notation=\"updiagonalstrike\"");
}
| QUAD { $$ = "<mspace width=\"1em\"/>"; }
| QQUAD { $$ = "<mspace width=\"2em\"/>"; }
| NEGSPACE { $$ = "<mspace width=\"negativethinmathspace\"/>"; }
| NEGMEDSPACE { $$ = "<mspace width=\"negativemediummathspace\"/>"; }
| NEGTHICKSPACE { $$ = "<mspace width=\"negativethickmathspace\"/>"; }
| THINSPACE { $$ = "<mspace width=\"thinmathspace\"/>"; }
| MEDSPACE { $$ = "<mspace width=\"mediummathspace\"/>"; }
| THICKSPACE { $$ = "<mspace width=\"thickmathspace\"/>"; }
| QUAD { $$ = newSpace(1); }
| QQUAD { $$ = newSpace(2); }
| NEGSPACE { $$ = newSpace(namedSpaceToEm("negativethinmathspace")); }
| NEGMEDSPACE { $$ = newSpace(namedSpaceToEm("negativemediummathspace")); }
| NEGTHICKSPACE { $$ = newSpace(namedSpaceToEm("negativethickmathspace")); }
| THINSPACE { $$ = newSpace(namedSpaceToEm("thinmathspace")); }
| MEDSPACE { $$ = newSpace(namedSpaceToEm("mediummathspace")); }
| THICKSPACE { $$ = newSpace(namedSpaceToEm("thickmathspace")); }
| SPACE textArg textArg textArg {
$$ = "<mspace height=\"." + $2 + "ex\" depth=\"." + $3 + "ex\" " +
"width=\"." + $4 + "em\"/>";
Expand Down
2 changes: 1 addition & 1 deletion unit-tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a0c0403

Please sign in to comment.