Increase the Maximum Number of Matrix Columns when Using LaTeX \bmatrix Environment
May. 12, 2025 • Updated May. 13, 2025
In LaTeX, when we use the \bmatrix environment to type mathematical matrices, we should note that the \bmatrix by default only supports matrices whose number of columns is less than or equal to 101. If not:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{bmatrix}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\
\end{bmatrix}
\end{equation}
\end{document}
an error will occur:
1
Extra alignment tab has been changed to \cr. 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 &
and the generated result is:

which is not as we expect.
To solve this problem, we can add such a command in the preamble2:
1
\addtocounter{MaxMatrixCols}{10}

or the command3:
1
\setcounter{MaxMatrixCols}{20}
References