mtable

Tests for MathML 4 mtable presentation attributes via mtable/mtable.js. Each row repeats the same MathML twice: the middle column is outside any polyfill wrapper (native mtable); the right column is wrapped in mtable-test-polyfill-root and processed with _MathTransforms.transform so you can compare native rendering with the polyfill. Unless a case is explicitly a 0×0 or 1×1 table, every mtable here has at least two non-empty rows or two non-empty columns. mlabeledtr tests are at the end of the page.

align (whole table)

Baseline reference x on both sides of the table in each row.

align values
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
align="top" x 12 r x
x 12 r x
align="bottom" x 12 r x
x 12 r x
align="center" x 12 r x
x 12 r x
align="baseline" x 12 r x
x 12 r x
align="axis" (default) x 12 r x
x 12 r x

align with row number

align and row index
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
align="baseline,1" and
align="baseline, 2"
x 12 r x 12 r x
x 12 r x 12 r x
align="baseline,-2" and
align="baseline, -1"
(should display the same as above row)
x 12 r x 12 r x
x 12 r x 12 r x
align="axis,1" and
align="axis,2"
x 12 r x 12 r x
x 12 r x 12 r x
align="axis,-2" and
align="axis,-1"
(should display the same as above row)
x 12 r x 12 r x
x 12 r x 12 r x

rowalign

rowalign list
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
Test all the rowalign attributes. top j t 12 3 1 23 bottom tj 12 3 1 23 center tj 12 3 1 23 baseline tj 12 3 1 23 axis tj 12 3 x 1 23
top j t 12 3 1 23 bottom tj 12 3 1 23 center tj 12 3 1 23 baseline tj 12 3 1 23 axis tj 12 3 x 1 23

mtr rowalign and columnalign

Per MathML 4, mtr may set rowalign and columnalign (space- or comma-separated lists, one token per column, last repeated) to override the enclosing mtable for that row only; mtd can override again.

mtr overrides mtable
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
mtable rowalign="center" columnalign="right"; second mtr uses rowalign="top, baseline, bottom" and columnalign="left center right". a 12 z x 12 t
a 12 z x 12 t

mtablemtrmtd

mtable sets rowalign="bottom" and columnalign="right" (lists repeat per row / column).
Each mtr overrides with its own rowalign / columnalign lists
Selected mtd elements override again.
Each cell is prefixed with (r, c) for the resolved alignment (bot for bottom; otherwise the first letter of rowalign / columnalign).

Inherited alignment overrides
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
Defaults on mtable; per-row lists on mtr; mtd overrides as in the list below.
Each cell starts with (r, c), telling what the rowalign / columnalign should be.
The first letter of the attr value is used, except bot = bottom.
(b, r)Qa+b+c23+y (b, c)x4 (bot, r)x (b, r)k+k (b, c)123+y (c, c)n2 (b, l)u (t, l)1t (c, r)r+s+t+u+v (bot, c)x23+y (t, l)Xi2+1 (b, r)p (t, r)123 (b, l)La+b+d (bot, l)g Label (t, r)123 (b, l)La+b+d (bot, l)g
(b, r)Qa+b+c23+y (b, c)x4 (bot, r)x (b, r)k+k (b, c)123+y (c, c)n2 (b, l)u (t, l)1t (c, r)r+s+t+u+v (bot, c)x23+y (t, l)Xi2+1 (b, r)p (t, r)123 (b, l)La+b+d (bot, l)g Label (t, r)123 (b, l)La+b+d (bot, l)g

Override map (row 0 = top of mtable):

  • Row 0mtr: rowalign="top baseline bottom", columnalign="left center right"; mtd (0,0): rowalign="axis", columnalign="right".
  • Row 1mtr: rowalign="center" (×3), columnalign="right center left"; mtd (1,2): columnalign="center".
  • Row 2mtr: rowalign="baseline axis center", columnalign="left center right"; mtd (2,1): rowalign="top", columnalign="left".
  • Row 3mtr only: rowalign="bottom top baseline", columnalign="center left right".
  • Row 4mtr: rowalign="top baseline bottom", columnalign="right left center"; mtd (4,2): rowalign="center", columnalign="left".
  • Row 5mlabeledtr (same lists as row 4 mtr): row lists apply to the three equation mtds only; the label column uses mtable rowalign / columnalign for that row/column.

columnalign

Three rows; columnalign="left center right"; columns have very different widths.

columnalign list
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
Left, center, and right alignment per column w+w+w m Za+b+x2+y+k x+1+s 12+tx+t w+i+di+d+e xa b+b+b+b+b+b+bb02 ii+0
w+w+w m Za+b+x2+y+k x+1+s 12+tx+t w+i+di+d+e xa b+b+b+b+b+b+bb02 ii+0

Column and table sizing

columnwidth, width
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
columnwidth="auto 6em fit" with width="28em" auto grows 6em fit column
auto grows 6em fit column
width="50%" half width table b
half width table b

Spacing between rows and columns

rowspacing, columnspacing
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
rowspacing="0.1ex 0.7ex 2ex" 1 2 3 4 5
1 2 3 4 5
columnspacing="0.1em 2em" a b c d
a b c d

Frames and row/column lines

rowlines, columnlines, frame, framespacing
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
rowlines="dashed none solid" 1a 2b 3c 4d 5e
1a 2b 3c 4d 5e
columnlines="dashed none solid" 1 2 3 4 5 a b c d e
1 2 3 4 5 a b c d e
frame="solid" framed b
framed b
frame="dashed" dashed frame c
dashed frame c
frame="solid" with framespacing="2em 2ex" padded frame d
padded frame d
frame="solid", rowlines="dashed dashed", columnlines="dashed dashed" 1 a 12 x +x nk2 π long text y=0
1 a 12 x +x nk2 π long text y=0

equalrows, equalcolumns

Equal sizing
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
equalrows="true" x x2 y x2 z3+k+m z
x x2 y x2 z3+k+m z
equalcolumns="true" WW MMMMMMMMMMMM a+b+c d ii
WW MMMMMMMMMMMM a+b+c d ii
equalrows="true"
equalcolumns="true"
x x2 y x2 z3+k+m z
x x2 y x2 z3+k+m z

displaystyle

Display style inside cells
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
No displaystyle attribute (MathML 4 default false inside table). k=1 n k 032 xdx
k=1 n k 032 xdx
displaystyle="true" k=1 n k 032 xdx
k=1 n k 032 xdx

mathcolor with rules

Lines use currentColor
Description Native mtable (no polyfill on this subtree) After _MathTransforms.transform
mathcolor on parent math with frame and row/column lines. 1 2 3 4
1 2 3 4

mlabeledtr

Labeled equation rows are expanded to mtr inside mtable/mtable.js (padding mtd on other rows, intent on the label). On mlabeledtr, rowalign / columnalign lists apply to equation mtds only; the label column uses mtable defaults for that row/column. On mtable, column-wise lists (columnalign, columnwidth, and mtr rowalign / columnalign) use list index n−1 for the label column so the first token is for the first equation column. columnspacing and rowspacing still use physical column/row gaps. columnlines list tokens apply only between equation columns (no rule between the label column and the equation block). The frame border wraps equation columns only (the label sits outside that outline). rowlines are drawn on equation cells only so they do not extend through the label column. Compare native (middle) with the polyfill (right).

mlabeledtr expansion, intent, and column-wise lists
Description Native (no polyfill on this subtree) After _MathTransforms.transform
Default mtable@side (right): label (2.1) on the right of the first row. (2.1) E = m c2 a2+b2=c2
(2.1) E = m c2 a2+b2=c2
mtable side="left": label on the left of the labeled row (second row here). a2+b2=c2 (2.1) E = m c2
a2+b2=c2 (2.1) E = m c2
Label intent: with property :equation-label
(console error if data-expected does not match).
(intent="foo") E = m c2 (intent "foo(1)") E = m c2 (intent=":my-property") E = m c2 (intent=":equation-label") E = m c2
(intent="foo") E = m c2 (intent "foo(1)") E = m c2 (intent=":my-property") E = m c2 (intent=":equation-label") E = m c2
mtable columnalign="left center right"
          columnlines="solid dashed"
the first row is labeled
(Label) a bbb c xxx y zzzz
(Label) a bbb c xxx y zzzz
mtable columnwidth="7em auto"
          columnlines="solid"
          columnspacing="1em 1em"
the first row is labeled
(Label) w+w+w z 1 2
(Label) w+w+w z 1 2
Label on the first and third row.
mtable: frame="solid" rowlines="solid" columnlines="dashed" rowspacing="0.6ex" columnspacing="0.5em 1.2em"
(Label 1) p q rrr s (Label 2) s tttt
(Label 1) p q rrr s (Label 2) s tttt
Label on the left side of the table.
mtable side="left" with columnalign="center right left" columnlines="solid" on mlabeledtr.
α βββ (Label) uuuu v
α βββ (Label) uuuu v
First row should align on top, then baseline, and label falls back to the mtable's rowalign="bottom".
Second row should align on bottom
mtable with rowalign="bottom"
mlabeledtr with rowalign="top baseline" columnalign="left right"
(1.1) x 032 xdx yyyy 12
(1.1) x 032 xdx yyyy 12