Skip to content

Commit 746899b

Browse files
authored
Merge pull request #2022 from dpvc/issue1993
Fix problem with position of under/over applied to tables. #1993
2 parents cc0364b + 5244c07 commit 746899b

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

unpacked/jax/output/HTML-CSS/autoload/mtable.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,10 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
473473
},
474474
HTMLhandleSpace: function (span) {
475475
span.bbox.keepPadding = true; span.bbox.exact = true;
476-
if (!this.hasFrame && span.bbox.width == null)
477-
{span.style.paddingLeft = span.style.paddingRight = HTMLCSS.Em(1/6)}
476+
if (!this.hasFrame && span.bbox.width == null) {
477+
span.firstChild.style.marginLeft = span.firstChild.style.marginRight = HTMLCSS.Em(1/6);
478+
span.bbox.w += 1/3; span.bbox.rw += 1/3; span.bbox.lw += 1/6;
479+
}
478480
this.SUPER(arguments).HTMLhandleSpace.call(this,span);
479481
}
480482
});

unpacked/jax/output/SVG/jax.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,30 +1992,33 @@
19921992
(base.movablelimits || base.CoreMO().Get("movablelimits")))
19931993
{return MML.msubsup.prototype.toSVG.call(this)}
19941994
var svg = this.SVG(), scale = this.SVGgetScale(svg); this.SVGhandleSpace(svg);
1995-
var boxes = [], stretch = [], box, i, m, W = -SVG.BIGDIMEN, WW = W;
1995+
var boxes = [], stretch = [], box, i, m, W = -SVG.BIGDIMEN, WW = W, ww;
19961996
for (i = 0, m = this.data.length; i < m; i++) {
19971997
if (this.data[i] != null) {
19981998
if (i == this.base) {
1999-
boxes[i] = this.SVGdataStretched(i,HW,D);
1999+
box = boxes[i] = this.SVGdataStretched(i,HW,D);
20002000
stretch[i] = (D != null || HW == null) && this.data[i].SVGcanStretch("Horizontal");
20012001
if (this.data[this.over] && values.accent) {
2002-
boxes[i].h = Math.max(boxes[i].h,scale*SVG.TeX.x_height); // min height of 1ex (#1706)
2002+
box.h = Math.max(box.h,scale*SVG.TeX.x_height); // min height of 1ex (#1706)
20032003
}
20042004
} else {
2005-
boxes[i] = this.data[i].toSVG(); boxes[i].x = 0; delete boxes[i].X;
2005+
box = boxes[i] = this.data[i].toSVG(); box.x = 0; delete box.X;
20062006
stretch[i] = this.data[i].SVGcanStretch("Horizontal");
20072007
}
2008-
if (boxes[i].w > WW) {WW = boxes[i].w}
2008+
ww = box.w + box.x + (box.X || 0);
2009+
if (ww > WW) {WW = ww}
20092010
if (!stretch[i] && WW > W) {W = WW}
20102011
}
20112012
}
20122013
if (D == null && HW != null) {W = HW} else if (W == -SVG.BIGDIMEN) {W = WW}
20132014
for (i = WW = 0, m = this.data.length; i < m; i++) {if (this.data[i]) {
2015+
box = boxes[i];
20142016
if (stretch[i]) {
2015-
boxes[i] = this.data[i].SVGstretchH(W);
2016-
if (i !== this.base) {boxes[i].x = 0; delete boxes[i].X}
2017+
box = boxes[i] = this.data[i].SVGstretchH(W);
2018+
if (i !== this.base) {box.x = 0; delete box.X}
20172019
}
2018-
if (boxes[i].w > WW) {WW = boxes[i].w}
2020+
ww = box.w + box.x + (box.X || 0);
2021+
if (ww > WW) {WW = ww}
20192022
}}
20202023
var t = SVG.TeX.rule_thickness * this.mscale;
20212024
var x, y, z1, z2, z3, dw, k, delta = 0;
@@ -2032,14 +2035,15 @@
20322035
boxes[i].Add(box); boxes[i].Clean();
20332036
boxes[i].w = -box.l; box = boxes[i];
20342037
}
2035-
dw = {left:0, center:(WW-box.w)/2, right:WW-box.w}[values.align];
2038+
ww = box.w + box.x + (box.X || 0);
2039+
dw = {left:0, center:(WW-ww)/2, right:WW-ww}[values.align];
20362040
x = dw; y = 0;
20372041
if (i == this.over) {
20382042
if (accent) {
20392043
k = t * scale; z3 = 0;
20402044
if (base.skew) {
20412045
x += base.skew; svg.skew = base.skew;
2042-
if (x+box.w > WW) {svg.skew += (WW-box.w-x)/2}
2046+
if (x+ww > WW) {svg.skew += (WW-ww-x)/2}
20432047
}
20442048
} else {
20452049
z1 = SVG.TeX.big_op_spacing1 * scale;

0 commit comments

Comments
 (0)