Mathematical structures such as matrices and vectors require elements
to be arranged in rows and columns. Just as we can align material in
rows and columns in text mode using the
tabular environment (§4.6. Aligning Material in Rows and Columns), we can do the
same in maths mode using the array environment. The
array environment has the same format as the
tabular environment, however it must be in maths mode.
The column half-gaps are given by the length register
\arraycolsep (analogous to
Example (Adding Delimiters):
Adding a Vertical Rule:
A vertical rule can be added using | in the column specifier. For example:
This example uses an invisible delimiter:
The amsmath package provides some convenient environments to typeset matrices: pmatrix, bmatrix, Bmatrix, vmatrix and Vmatrix. These are similar to the array environment except there is no argument, and they add (respectively) , , , and delimiters. There is also the matrix environment that doesn't have any delimiters.
The amsmath package also provides the environment smallmatrix designed for in-line use. You need to add any delimiters explicitly.
This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).