What is the difference between the matrix and array environments?
Best Answer
array is a default environment of LaTeX available to any document class, whilst matrix come with amsmath package or AMS classes (amsbook, amsart)
The matrix environment mainly exist for naming consistency, because amsmath also provides several environments for matrices with delimiters (e.g. pmatrix, bmatrix, Bmatrix, vmatrix, and Vmatrix).
In matrix there are not column specifications as {ccc}. By default, you can have up to ten centered columns (for another alignment you must stay with array). If you need more than ten columns you must modify the MaxMatrixCols counter.
matrix is more economical with horizontal spacing (i.e., array is wider than matrix).
The array environment is for math mode and cell contents will be typeset in math mode (textstyleby default) and tabular is for text mode.
While array requires being in math mode, the tabular environment can be used in math mode, and its contents will be typeset in text mode. Inside an array, the p, m or b specifiers also switch cell contents to text mode.
Best Answer
array
is a default environment of LaTeX available to any document class, whilstmatrix
come withamsmath
package or AMS classes (amsbook
,amsart
)The
matrix
environment mainly exist for naming consistency, becauseamsmath
also provides several environments for matrices with delimiters (e.g.pmatrix
,bmatrix
,Bmatrix
,vmatrix
, andVmatrix
).In
matrix
there are not column specifications as{ccc}
. By default, you can have up to ten centered columns (for another alignment you must stay witharray
). If you need more than ten columns you must modify theMaxMatrixCols
counter.matrix
is more economical with horizontal spacing (i.e.,array
is wider thanmatrix
).