Skip to content

Commit e715e1d

Browse files
committed
Merge pull request #1503 from dpvc/issue1500
Handle adjusting cell heights properly. #1500
2 parents b11691e + fef4254 commit e715e1d

File tree

1 file changed

+6
-6
lines changed
  • unpacked/jax/output/CommonHTML/autoload

1 file changed

+6
-6
lines changed

unpacked/jax/output/CommonHTML/autoload/mtable.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
187187
CALIGN = state.CALIGN, RALIGN = state.RALIGN,
188188
RCALIGN = state.RCALIGN;
189189
CSPACE[state.J] *= 2; RSPACE[ROWS.length-1] *= 2; // since halved below
190-
var LH = CHTML.FONTDATA.lineH * values.useHeight,
191-
LD = CHTML.FONTDATA.lineD * values.useHeight;
192190
var T = "0", B, R, L, border, cbox, align;
193191
if (values.fspace) T = CHTML.Em(state.FSPACE[1]);
194192
for (var i = 0, m = ROWS.length; i < m; i++) {
@@ -245,11 +243,12 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
245243
);
246244
}
247245
//
248-
// Pad cells that are too short
246+
// Adjust height and depth of cells
249247
//
250248
cell = row[j].firstChild.style;
251-
if (cbox.h < LH) cell.marginTop = CHTML.Em(LH-cbox.h);
252-
if (cbox.d < LD) cell.marginBottom = CHTML.Em(LD-cbox.d);
249+
var H = Math.max(1,cbox.h);
250+
if (H !== state.H[i]) cell.marginTop = CHTML.Em(state.H[i]-H);
251+
if (cbox.d < state.D[i]) cell.marginBottom = CHTML.Em(state.D[i]-cbox.d);
253252
}
254253
T = B;
255254
}
@@ -494,7 +493,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
494493
if (LABELS[i] && this.data[i].data[0]) {
495494
labels.appendChild(LABELS[i]);
496495
var lbox = this.data[i].data[0].CHTML;
497-
T += h - lbox.h;
496+
T += h - Math.max(1,lbox.h);
498497
if (T) LABELS[i].style.marginTop = CHTML.Em(T);
499498
T = d - lbox.d;
500499
} else {
@@ -563,6 +562,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
563562
MML.mtd.Augment({
564563
toCommonHTML: function (node,options) {
565564
node = this.CHTMLdefaultNode(node,options);
565+
CHTML.addElement(node.firstChild,"mjx-strut"); // forces height to 1em (we adjust later)
566566
//
567567
// Determine if this is stretchy or not
568568
//

0 commit comments

Comments
 (0)