Skip to content

Commit 7e87b25

Browse files
committed
Update how the space is reserved for tags so work better with percentage width tables. This changes what the precentage is relative to, so that the table will not overlap the tags (so 100% means 100% of the space other than that used by tags -- this is a change from v2).
1 parent 1f4fbc1 commit 7e87b25

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mathjax3-ts/output/chtml/Wrappers/mtable.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export class CHTMLmtable<N, T, D> extends CHTMLWrapper<N, T, D> {
6161
'mjx-mtable': {
6262
'vertical-align': '.25em',
6363
'text-align': 'center',
64-
'position': 'relative'
64+
'position': 'relative',
65+
'box-sizing': 'border-box'
6566
},
6667
'mjx-mtable > mjx-itable': {
6768
'vertical-align': 'middle',
@@ -670,8 +671,12 @@ export class CHTMLmtable<N, T, D> extends CHTMLWrapper<N, T, D> {
670671
//
671672
const {L} = this.getTableData();
672673
const sep = this.length2em(this.node.attributes.get('minlabelspacing'));
673-
const table = adaptor.firstChild(this.chtml) as N;
674-
adaptor.setStyle(table, 'margin', '0 ' + this.em(L + sep)); // FIXME, handle indentalign values
674+
let pad = L + sep; // FIXME, handle indentalign values
675+
const [lpad, rpad] = [this.styles.get('padding-left'), this.styles.get('padding-right')];
676+
if (lpad || rpad) {
677+
pad = Math.max(pad, this.length2em(lpad || '0'), this.length2em(rpad || '0'));
678+
}
679+
adaptor.setStyle(this.chtml, 'padding', '0 ' + this.em(pad));
675680
//
676681
// Add the labels to the table
677682
//

0 commit comments

Comments
 (0)