From 67b0d976c1eacc6c156eb37ce482952fc6c6ff45 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" <dpvc@union.edu> Date: Sun, 2 Jul 2017 19:33:45 -0400 Subject: [PATCH] Pad table rows when there are row or column lines. Resolves issue #1711. --- unpacked/jax/output/CommonHTML/autoload/mtable.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/unpacked/jax/output/CommonHTML/autoload/mtable.js b/unpacked/jax/output/CommonHTML/autoload/mtable.js index 64257f219..07df5395b 100644 --- a/unpacked/jax/output/CommonHTML/autoload/mtable.js +++ b/unpacked/jax/output/CommonHTML/autoload/mtable.js @@ -201,6 +201,11 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { // B = RSPACE[i]/2; border = null; L = "0"; if (RLINES[i] !== MML.LINES.NONE && RLINES[i] !== "") border = state.t+" "+RLINES[i]; + if (border || (CLINES[j] !== MML.LINES.NONE && CLINES[j] !== "")) { + while (row.length < CLINES.length) { + row.push(CHTML.addElement(row.node,"mjx-mtd",null,[['span']])); + } + } state.RH[i] = lastB + state.H[i]; // distance to baseline in row lastB = Math.max(0,B); state.RHD[i] = state.RH[i] + lastB + state.D[i]; // total height of row @@ -214,7 +219,8 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { // for (var j = 0, M = row.length; j < M; j++) { var s = (rdata.type === "mtr" ? 0 : LABEL); - cell = row[j].style; cbox = rdata.data[j-s].CHTML; + var mtd = rdata.data[j-s] || {CHTML: CHTML.BBOX.zero()}; + cell = row[j].style; cbox = mtd.CHTML; // // Space and borders between columns // @@ -230,7 +236,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { // // Handle vertical alignment // - align = (rdata.data[j-s].rowalign||this.data[i].rowalign||RALIGN[i]); + align = (mtd.rowalign||(this.data[i]||{}).rowalign||RALIGN[i]); var H = Math.max(1,cbox.h), D = Math.max(.2,cbox.d), HD = (state.H[i]+state.D[i]) - (H+D), child = row[j].firstChild.style; @@ -249,7 +255,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { // // Handle horizontal alignment // - align = (rdata.data[j-s].columnalign||RCALIGN[i][j]||CALIGN[j]); + align = (mtd.columnalign||RCALIGN[i][j]||CALIGN[j]); if (align !== MML.ALIGN.CENTER) cell.textAlign = align; } row.node.style.height = CHTML.Em(state.RHD[i]); -- GitLab