Matrices
amsmath
matrix environments
The amsmath
package provides commands to typeset matrices with different delimiters. Once you have loaded \usepackage{amsmath}
in your preamble, you can use the following environments in your math environments:
Type | LaTeX markup | Renders as |
---|---|---|
Plain | \begin{matrix}
|
\(\begin{matrix}1 & 2 & 3\\a & b & c\end{matrix}\) |
Parentheses; round brackets |
\begin{pmatrix}
|
\(\begin{pmatrix}1 & 2 & 3\\a & b & c\end{pmatrix}\) |
Brackets; square brackets |
\begin{bmatrix}
|
\(\begin{bmatrix}1 & 2 & 3\\a & b & c\end{bmatrix}\) |
Braces; curly brackets |
\begin{Bmatrix}
|
\(\begin{Bmatrix}1 & 2 & 3\\a & b & c\end{Bmatrix}\) |
Pipes | \begin{vmatrix}
|
\(\begin{vmatrix}1 & 2 & 3\\a & b & c\end{vmatrix}\) |
Double pipes | \begin{Vmatrix}
|
\(\begin{Vmatrix}1 & 2 & 3\\a & b & c\end{Vmatrix}\) |
If you need to create matrices with different delimiters, you can add them manually to a plain matrix
. For example:
LaTeX markup | Renders as |
---|---|
\left\lceil
|
\(\left\lceil\begin{matrix}1 & 2 & 3\\a & b & c\end{matrix}\right\rceil\) |
\left\langle
|
\(\left\langle\begin{matrix}1 & 2 & 3\\a & b & c\end{matrix}\right\rvert\) |
\left\langle
|
\(\left\langle\begin{matrix}1 & 2 & 3\\a & b & c\end{matrix}\right\rangle\) |
Inline matrices
When typesetting inline math, the usual matrix
environments above may look too big. It may be better to use smallmatrix
in such situations, although you will need to provide your own delimiters.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent Trying to typeset an inline matrix here:
$\begin{pmatrix}
a & b\\
c & d
\end{pmatrix}$,
but it looks too big, so let's try
$\big(\begin{smallmatrix}
a & b\\
c & d
\end{smallmatrix}\big)$
instead.
\end{document}
Open this smallmatrix
example in Overleaf
The following image shows the output produced by the example above:
The mathtools
package provides psmallmatrix
, bsmallmatrix
etc environments for convenience.