Hi there!
The team behind LaTeX Math for Confluence is back with another guide on creating matrices, one of the most common ways to organize numbers or expressions in a grid.
Missed earlier guides?
Basic matrix syntax in LaTeX
In LaTeX, a matrix is created inside a special environment that arranges elements into rows and columns. The simplest option is the {matrix} environment:
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}
Here's how it works:
This code will produce:

Adding brackets to matrices
You'll need a different environment if you want brackets around the matrix. Instead of {matrix}, use one of the following:
-
{pmatrix} → parentheses ( )
-
{bmatrix} → square brackets [ ]
-
{Bmatrix} → curly braces { }
-
{vmatrix} → vertical bars | |
-
{Vmatrix} → double vertical bars ‖ ‖
Example: 2x2 matrix with parentheses
\begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}

Example: 3x3 matrix with square brackets
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}

Adjusting matrix size in Confluence
In LaTeX, you can adjust the size of matrices using formatting commands like \small or \scriptstyle. These commands are helpful when you want to fit a formula into a limited space or make a large matrix more readable.
Using the \small LaTeX command
The \small command reduces the overall font size of the matrix. It works well when you want a moderately smaller matrix without making it too tiny.
Example:
\small
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
Using \scriptstyle for subscript-sized matrices
The \scriptstyle command makes the matrix very compact. It is often used for inline formulas, nested matrices, or when you want to fit a matrix into a tight space. The matrix will appear more "compressed" than with \small.
Example:
\scriptstyle
\begin{bmatrix}
1 & 2 \\
3 & 4
\end{bmatrix}
Here's a visual comparison showing a standard matrix alongside the same matrix reduced with \small and \scriptstyle:

Matrices in LaTeX are simple to create and customize with different types of brackets and size adjustments. And with LaTeX Math for Confluence (Cloud), you can display them cleanly in your documentation.
✅ Next, we'll show how arrays differ from matrices and why they're helpful.