Math Mode – How to Add a Matrix to a LaTeX Document
math-modematrices
How do we add a matrix to a LaTeX document?
Best Answer
Ash's answer typesets the matrix inline with the text. A (perhaps) nicer way to do this is to use the smallmatrix environment in the amsmath package. Add to the document preamble:
Best Answer
Ash's answer typesets the matrix inline with the text. A (perhaps) nicer way to do this is to use the
smallmatrix
environment in theamsmath
package. Add to the document preamble:And then you can do:
If you want to bracket the matrix you can also do:
The
amsmath
package also offers the shortcutmatrix
environments which default to centered alignment for their columns:matrix
: unbracketed matrixpmatrix
: matrix surrounded by parenthesesbmatrix
: matrix surrounded by square bracketsvmatrix
: matrix surrounded by single vertical linesVmatrix
: matrix surrounded by double vertical linesThis info is found in "The LaTeX Companion", and the
amsmath
manual section 4.