mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
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:
@@ -12,13 +12,16 @@ const htmlModBuilder = (group, options) => {
|
||||
const inner = [];
|
||||
|
||||
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()) {
|
||||
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) {
|
||||
inner.push(buildCommon.makeSpan(["mspace", "quad"], [], options));
|
||||
} else if (group.value.modType === "mod") {
|
||||
@@ -40,12 +43,13 @@ const htmlModBuilder = (group, options) => {
|
||||
buildCommon.mathsym("d", group.mode)];
|
||||
if (group.value.modType === "bmod") {
|
||||
inner.push(buildCommon.makeSpan(["mbin"], modInner, options));
|
||||
// “\mkern5mu\nonscript\mskip-\medmuskip”
|
||||
inner.push(
|
||||
buildCommon.makeSpan(["mspace", "thickspace"], [], options));
|
||||
// “\mkern5mu\nonscript\mskip-\medmuskip” as above
|
||||
if (!options.style.isTight()) {
|
||||
inner.push(buildCommon.makeSpan(
|
||||
["mspace", "negativemediumspace"], [], options));
|
||||
["mspace", "muspace"], [], options));
|
||||
} else {
|
||||
inner.push(buildCommon.makeSpan(
|
||||
["mspace", "thickspace"], [], options));
|
||||
}
|
||||
} else {
|
||||
Array.prototype.push.apply(inner, modInner);
|
||||
|
@@ -118,6 +118,7 @@
|
||||
@ptperem: 10.0;
|
||||
@nulldelimiterspace: 1.2em / @ptperem;
|
||||
|
||||
@muspace: 0.055556em; // 1mu
|
||||
@thinspace: 0.16667em; // 3mu
|
||||
@mediumspace: 0.22222em; // 4mu
|
||||
@thickspace: 0.27778em; // 5mu
|
||||
@@ -327,6 +328,10 @@
|
||||
margin-left: -@thinspace;
|
||||
}
|
||||
|
||||
&.muspace {
|
||||
width: @muspace;
|
||||
}
|
||||
|
||||
&.thinspace {
|
||||
width: @thinspace;
|
||||
}
|
||||
|
Reference in New Issue
Block a user