by Stefan Kottwitz » Sun Oct 24, 2021 9:58 pm
Internally,
amsmath
uses an
array
environment with a number of columns set to
MaxMatrixCols
. That is a counter, intially set to 10. That's usually enough, but in case we need bigger matrices, we can modify the counter, also globally, by
\setcounter{MaxMatrixCols}{<value>}
. Here, we set the
MaxMatrixCols
value to 11, and now it compiles without error:
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{11}
\begin{document}
\[
A = \begin{pmatrix}
a_{11} & a_{12} & a_{13} & a_{14} & a_{15} & a_{16} & a_{17} & a_{18} & a_{19} & a_{10} & a_{11} \\
a_{21} & a_{22} & a_{23} & a_{24} & a_{25} & a_{26} & a_{27} & a_{28} & a_{29} & a_{20} & a_{21}
\end{pmatrix}
\]
\end{document}
We get:

- matrix.png (9.52 KiB) Viewed 60786 times
Of course, we can also set it to a higher value. Btw. we had that question here earlier, in the topics
Matrix Alignment Error and
Problem with creating a matrix.
Stefan
Internally, [latex]amsmath[/latex] uses an [latex]array[/latex] environment with a number of columns set to [latex]MaxMatrixCols[/latex]. That is a counter, intially set to 10. That's usually enough, but in case we need bigger matrices, we can modify the counter, also globally, by [latex]\setcounter{MaxMatrixCols}{<value>}[/latex]. Here, we set the [latex]MaxMatrixCols[/latex] value to 11, and now it compiles without error:
[code]\documentclass{article}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{11}
\begin{document}
\[
A = \begin{pmatrix}
a_{11} & a_{12} & a_{13} & a_{14} & a_{15} & a_{16} & a_{17} & a_{18} & a_{19} & a_{10} & a_{11} \\
a_{21} & a_{22} & a_{23} & a_{24} & a_{25} & a_{26} & a_{27} & a_{28} & a_{29} & a_{20} & a_{21}
\end{pmatrix}
\]
\end{document}[/code]
We get:
[attachment=0]matrix.png[/attachment]
Of course, we can also set it to a higher value. Btw. we had that question here earlier, in the topics [url=https://latex.org/forum/viewtopic.php?f=44&t=22804]Matrix Alignment Error[/url] and [url=https://latex.org/forum/viewtopic.php?f=46&t=5996]Problem with creating a matrix[/url].
Stefan