matrices is about matrices in equations and diagrams.
Using AMS-LaTeX (package amsmath
, the AMS document classes, etc.), there are several commands to create matrices in math mode. For example,
I_2 = \begin{bmatrix}
1 & 0 \\
0 & 1
\end{bmatrix}
typesets:
There are many other commands available to typeset matrices:
- The
bmatrix
environment, shown above, typesets a matrix in braces.matrix
typesets a matrix with no delimiters;pmatrix
uses parentheses,Bmatrix
uses braces,vmatrix
uses vertical lines, andVmatrix
uses double vertical lines. - The
matrix*
environment allows one to specify the alignment of the matrix elements: for example,\begin{matrix*}[r]
...\end{matrix*}
right-aligns all of the columns. There's alsopmatrix*
,bmatrix*
, etc. - The
smallmatrix
environment typesets a matrix in line, and is small enough to look good in text-style math. In addition, themathtools
package providespsmallmatrix
,bsmallmatrix
, etc., which also add delimiters on each side. - The bordermatrix command allows one to annotate the rows or columns of a matrix (also see the
kbordermatrix
package). - The
spalign
package provides a facility for typesetting matrices, and using other alignment environments and macros, with spaces as the alignment delimiter and semicolons (by default) as the end-of-row indicator. This package also contains utility macros for typesetting augmented matrices, vectors, arrays, and more, and is easily extendable to other situations that use alignments. - TikZ has a
matrix
library which allows extensive customization. If your question is about this library, use the tikz-matrix tag.
#Frequently asked questions: