Matrices
Using the delimiters seen before, you can already create matrices. Or, rather, things that look somewhat like a matrix.
But let’s never forget the semantics and use a proper matrix environment for this. It looks better and you can read your TeX file and immediately know what is supposed to represent a matrix (and what isn’t).
The environments below all roughly do the same—create a matrix—but have subtle differences that might simplify your life. They all follow the general table syntax.
1\begin{matrixType}
2 row 1, number 1 & … & row 1, number n \\
3 % … \\
4 row m, number 1 & … & row m, number n
5\end{matrixType}
Each row is terminated by a newline (two backslashes) and each column by an ampersand.
Plain Matrix
The matrix
environment creates a matrix with everything lined up correctly, but nothing around it to signal it’s a matrix. This is useful, for instance, for creating a submatrix within a matrix.
1\[
2 \begin{matrix}
3 0 & 1 & 2 \\
4 3 & 4 & 5 \\
5 6 & 7 & 8
6 \end{matrix}
7\]
Surrounded Matrices
One of the following environments can be used if you want a certain kind of delimiter surrounding your matrix:
Environment | Description |
---|---|
bmatrix | Brackets around the matrix (usual notation) |
Bmatrix | Braces around the matrix |
pmatrix | Parentheses around the matrix |
vmatrix | Vertical bars around the matrix (used to represent the determinant) |
Vmatrix | Double vertical-bars around the matrix |
1\[
2 \begin{bmatrix}
3 0 & 1 & 2\
4 3 & 4 & 5\
5 6 & 7 & 8
6 \end{bmatrix}
7\]
Inline Matrices
To use a matrix inline—so that the flow of text is not disrupted—use the smallmatrix
environment.
This, however, only creates a smaller plain matrix. You need to add delimiters yourself. And the matrix can’t be too large to begin with.
1This matrix, $\begin{smallmatrix} a & 0\0 & b \end{smallmatrix}$, is inline.
Want to support me?
Buy one of my projects. You get something nice, I get something nice.
Donate through a popular platform using the link below.
Simply giving feedback or spreading the word is also worth a lot.