Avoid negative space in \bmod. (#984)

This is a workaround for #836 for the command case of using \bmod,
without changing any spacing (and making the code and generated output
slightly more efficient).  In particular, fix #982.
This commit is contained in:
Erik Demaine
2017-11-26 20:24:31 -05:00
committed by GitHub
parent 2ca6c3c73b
commit f6a377b91c
2 changed files with 17 additions and 8 deletions

View File

@@ -12,13 +12,16 @@ const htmlModBuilder = (group, options) => {
const inner = []; const inner = [];
if (group.value.modType === "bmod") { if (group.value.modType === "bmod") {
// “\nonscript\mskip-\medmuskip\mkern5mu” // “\nonscript\mskip-\medmuskip\mkern5mu”, where \medmuskip is
// 4mu plus 2mu minus 1mu, translates to 1mu space in
// display/textstyle and 5mu space in script/scriptscriptstyle.
if (!options.style.isTight()) { if (!options.style.isTight()) {
inner.push(buildCommon.makeSpan( inner.push(buildCommon.makeSpan(
["mspace", "negativemediumspace"], [], options)); ["mspace", "muspace"], [], options));
} else {
inner.push(buildCommon.makeSpan(
["mspace", "thickspace"], [], options));
} }
inner.push(
buildCommon.makeSpan(["mspace", "thickspace"], [], options));
} else if (options.style.size === Style.DISPLAY.size) { } else if (options.style.size === Style.DISPLAY.size) {
inner.push(buildCommon.makeSpan(["mspace", "quad"], [], options)); inner.push(buildCommon.makeSpan(["mspace", "quad"], [], options));
} else if (group.value.modType === "mod") { } else if (group.value.modType === "mod") {
@@ -40,12 +43,13 @@ const htmlModBuilder = (group, options) => {
buildCommon.mathsym("d", group.mode)]; buildCommon.mathsym("d", group.mode)];
if (group.value.modType === "bmod") { if (group.value.modType === "bmod") {
inner.push(buildCommon.makeSpan(["mbin"], modInner, options)); inner.push(buildCommon.makeSpan(["mbin"], modInner, options));
// “\mkern5mu\nonscript\mskip-\medmuskip” // “\mkern5mu\nonscript\mskip-\medmuskip” as above
inner.push(
buildCommon.makeSpan(["mspace", "thickspace"], [], options));
if (!options.style.isTight()) { if (!options.style.isTight()) {
inner.push(buildCommon.makeSpan( inner.push(buildCommon.makeSpan(
["mspace", "negativemediumspace"], [], options)); ["mspace", "muspace"], [], options));
} else {
inner.push(buildCommon.makeSpan(
["mspace", "thickspace"], [], options));
} }
} else { } else {
Array.prototype.push.apply(inner, modInner); Array.prototype.push.apply(inner, modInner);

View File

@@ -118,6 +118,7 @@
@ptperem: 10.0; @ptperem: 10.0;
@nulldelimiterspace: 1.2em / @ptperem; @nulldelimiterspace: 1.2em / @ptperem;
@muspace: 0.055556em; // 1mu
@thinspace: 0.16667em; // 3mu @thinspace: 0.16667em; // 3mu
@mediumspace: 0.22222em; // 4mu @mediumspace: 0.22222em; // 4mu
@thickspace: 0.27778em; // 5mu @thickspace: 0.27778em; // 5mu
@@ -327,6 +328,10 @@
margin-left: -@thinspace; margin-left: -@thinspace;
} }
&.muspace {
width: @muspace;
}
&.thinspace { &.thinspace {
width: @thinspace; width: @thinspace;
} }