fix: Correct for negative margin in integrand lower limits (#2987)

* fix: Correct for negative margin in integrand lower limits.

* Adjust for width limit.

* Update screenshots.

* Update Safari screenshot.

* Catch null subGroup.

* Remove redundant code.
This commit is contained in:
Ron Kok
2021-05-11 18:26:35 -07:00
committed by GitHub
parent 1ed90e4a65
commit 9b4acc971c
5 changed files with 13 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
// @flow
import buildCommon from "../../buildCommon";
import * as html from "../../buildHTML";
import utils from "../../utils";
import type {StyleInterface} from "../../Style";
import type Options from "../../Options";
import type {DomSpan, SymbolNode} from "../../domTree";
@@ -18,6 +19,7 @@ export const assembleSupSub = (
baseShift: number,
): DomSpan => {
base = buildCommon.makeSpan([], [base]);
const subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);
let sub;
let sup;
// We manually have to handle the superscripts and subscripts. This,
@@ -105,6 +107,13 @@ export const assembleSupSub = (
return base;
}
return buildCommon.makeSpan(
["mop", "op-limits"], [finalGroup], options);
const parts = [finalGroup];
if (sub && slant !== 0 && !subIsSingleCharacter) {
// A negative margin-left was applied to the lower limit.
// Avoid an overlap by placing a spacer on the left on the group.
const spacer = buildCommon.makeSpan(["mspace"], [], options);
spacer.style.marginRight = `${slant}em`;
parts.unshift(spacer);
}
return buildCommon.makeSpan(["mop", "op-limits"], parts, options);
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -184,7 +184,8 @@ Integrands: |
\begin{array}{l}
\displaystyle \int + \oint + \iint + \oiint_i^n \\[0.6em]
\displaystyle \iiint + \oiiint + \textstyle \int + \oint_i^n \\[0.6em]
\iint + \oiint + \iiint + \oiiint
\iint + \oiint + \iiint + \oiiint \\[0.6em]
\int\limits^x_{y + 4 - a} \int\limits^x_{y + 4 - a}
\end{array}
KaTeX:
tex: \KaTeX, \large \KaTeX