About

{matrices} is about matrices in {equations} and {diagrams}.

is about matrices in and .

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:

enter image description here

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, and Vmatrix 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 also pmatrix*, bmatrix*, etc.
  • The smallmatrix environment typesets a matrix in line, and is small enough to look good in text-style math. In addition, the mathtools package provides psmallmatrix, bsmallmatrix, etc., which also add delimiters on each side.
  • The command allows one to annotate the rows or columns of a matrix (also see the kbordermatrix package).
  • TikZ has a matrix library which allows extensive customization. If your question is about this library, use the tag.

Frequently asked questions:

history | excerpt history