mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.2k stars 1.16k forks source link

v4-beta.3 Top or bottom allignment of array #3100

Open zurawsm3 opened 1 year ago

zurawsm3 commented 1 year ago

Issue Summary

Top and bottom allignment of array not works.

Steps to Reproduce:

Run code from repo

Technical details:

Supporting information:

URL to repo: https://github.com/zurawsm3/math-tasks

image

Question

Is Mathjax v4 supports top and bottom alignment in arrays?

dpvc commented 1 year ago

I believe you are misunderstanding what the [b] and [t] options to the array environment are meant to do. These specify how the array as a whole is positioned relative to the surrounding mathematics. Normally, an array is centered on the math axis (which is around the position of a minus sign). With [t] the array is placed so its top line aligns with the surrounding text, and with [b], its bottom line aligns with the surrounding text. Neither has anything to do with the alignment of the cells within the array.

That is,

$$x
\begin{array}{c}
a\\b\\c\\d
\end{array}
x$$

produces

middle

whereas

$$x
\begin{array}[t]{c}
a\\b\\c\\d
\end{array}
x$$

produces

top

and

$$x
\begin{array}[b]{c}
a\\b\\c\\d
\end{array}
x$$

produces

bottom

MathJax v4 implements the preamble column types from the LaTeX array.sty package. See the alpha release notes for more details. You can use the p, m, and b column types to produce top-aligned, centered, and bottom-aligned cells in a column, but these require a specific width to be specified. You can also use \vtop, \vcenter, and \vbox within a cell to make single cells that are top, center, or bottom aligned, but these won't have automatic line breaking unless you include \hsize=<dimen> within them, making them a specific fixed width.

The beta.3 release introduced a new non-standard \breakAlign macro that allows you to specify how a single cell, a whole row, or every cell in the table is aligned, without having to specify a column width, which will still support automatic line breaks. See the beta.3 release notes for more details.

So the output you are seeing is the correct result of the expressions you have entered. Use the features described here to adjust the alignment within rows of an array.

zurawsm3 commented 1 year ago

Wow. Thank You. Brilliantly explained