Fix lap vertical alignment. (#1162)

* Fix lap vertical alignment.

Fixes issue #1153.

* Fix horizontal alignment

Wrap the entire lap pair with a mord.

* Support Unicode \ll and \lll

Fixes issue #1271

* Update screenshots

* Update screenshots

* generated updated screenshots for Lap

* Change double strut to single strut

* Delete screenshotter test

* Add (commented out) test

* Fix mis-spelled word
This commit is contained in:
Ron Kok
2018-05-24 18:27:15 -07:00
committed by Kevin Barabash
parent ef666c18da
commit a5e6b92ff1
5 changed files with 28 additions and 4 deletions

View File

@@ -36,8 +36,26 @@ defineFunction({
["inner"], [html.buildGroup(group.value.body, options)]);
}
const fix = buildCommon.makeSpan(["fix"], []);
return buildCommon.makeSpan(
["mord", group.value.alignment], [inner, fix], options);
let node = buildCommon.makeSpan(
[group.value.alignment], [inner, fix], options);
// At this point, we have correctly set horizontal alignment of the
// two items involved in the lap.
// Next, use a strut to set the height of the HTML bounding box.
// Otherwise, a tall argument may be misplaced.
const strut = buildCommon.makeSpan(["strut"]);
strut.style.height = (node.height + node.depth) + "em";
strut.style.verticalAlign = -node.depth + "em";
node.children.unshift(strut);
// Next, prevent vertical misplacement when next to something tall.
node = buildCommon.makeVList({
positionType: "firstBaseline",
children: [{type: "elem", elem: node}],
}, options);
// Get the horizontal spacing correct relative to adjacent items.
return buildCommon.makeSpan(["mord"], [node], options);
},
mathmlBuilder: (group, options) => {
// mathllap, mathrlap, mathclap

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

View File

@@ -132,7 +132,13 @@ KaTeX:
Kern:
tex: \frac{a\kern{1em}b}{c}a\kern{1em}b\kern{1ex}c\kern{-0.25em}d
nolatex: LaTeX fails to typeset this, “Missing number, treated as zero.”
Lap: ab\mathllap{f}cd\mathrlap{g}hij\mathclap{k}lm \; ab\llap{f}cd\rlap{g}hij\clap{k}lm
# The following test, Lap, is commented out pending a successful screenshotter test.
# Lap: |
# \begin{array}{l}
# ab\mathllap{f}cd\mathrlap{g}hij\mathclap{k}lm \; ab\llap{f}cd\rlap{g}hij\clap{k}lm \\
# \mathrlap{\frac a b} \frac a b \\
# \mathrlap{\overbrace{\phantom{a_0+a_1+a_2}}^m}a_0+a_1+a_2
# \end{array}
LargeRuleNumerator: \frac{\textcolor{blue}{\rule{1em}{2em}}}{x}
LaTeX: \text{\LaTeX}, \text{\TeX}
LeftRight: \left( x^2 \right) \left\{ x^{x^{x^{x^x}}} \right.
@@ -350,7 +356,7 @@ TextStacked:
\textsf{\textrm{\textbf{abc123}} \textbf{abc123} \textit{abc123}}\\
\textit{abc123 \textbf{abc123} \textsf{abc123}}\\
\end{matrix}
TextWithMath:
TextWithMath:
\begin{matrix}
\text{for $a < b$ and $ c < d $}. \\
\textsf{for $a < b$ and $ c < d $}. \\