LaTeX matrix generator
Set the number of rows and columns, type the values or paste a block of cells from Excel, pick the brackets and copy the code. Matrices up to 10 x 10, with a preview that shows how it will look in the PDF.
Rows
2
Columns
2
Brackets
Preview
LaTeX code
\[
A = \begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}
\]Type numbers or LaTeX expressions, e.g. \frac{1}{2}. Enter moves to the cell below; paste a block of numbers from a spreadsheet into the first cell.
How it works
- Each bracket type is its own amsmath environment: pmatrix ( ), bmatrix [ ], vmatrix | | for a determinant, Vmatrix ‖ ‖ for a norm, Bmatrix { } and matrix without brackets.
- A block of cells pasted from a spreadsheet is spread over rows and columns starting at the cell you paste into.
- A decimal comma is written as {,}, because a plain comma in math mode adds a space: 2{,}5 prints like 2,5.
- Cells accept regular LaTeX, such as \frac{1}{2} or \pi, and the matrix name (e.g. A or B^T) goes before an equals sign.
Matrix bracket types
| Environment | Looks like | Use it for |
|---|---|---|
pmatrix | the most common matrix notation | |
bmatrix | square brackets, common in physics and computer science | |
vmatrix | a determinant | |
Vmatrix | a matrix norm | |
Bmatrix | curly braces | |
matrix | bare values, e.g. inside your own brackets |
Packages you need
\usepackage{amsmath} % pmatrix, bmatrix, vmatrixMore examples and common mistakes: Matrices in LaTeX: pmatrix, bmatrix, determinant
Other tools
Got formulas on paper?
Draw them or snap a photo and CamteX AI turns them into LaTeX and inserts them into your document.
