Error in matrix form? [duplicate]

I am writing this matrix in my report:

  \begin{align}
\mathbf{x}=
\begin{pmatrix}
1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\
1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0\\
1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0\\
1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0
\end{pmatrix}^\mathrm{T},
\end{align}


I found errors pdfLatex> ! Extra alignment tab has been changed to \cr

marked as duplicate by Werner, egreg, Guido, Adam Liter, user31729 Jul 15 '14 at 22:23

• This is very similar in nature to How to create a matrix with 20 columns in LaTeX. The solution is to increase the maximum number of columns to suit your needs (via the counter MaxMatrixCols). – Werner Jul 15 '14 at 22:01
• @Werner Your link makes my answer look a little silly, even though my route was RTFM:) Probably should be marked as a duplicate and I shold delete my answer. – Andrew Jul 15 '14 at 22:07
• @Andrew: Although the question is a duplicate, it does not mean that your answer is silly or wrong. There is no need of deleting it really. – user31729 Jul 15 '14 at 22:24

From the amsldoc manual:

The maximum number of columns in a matrix is determined by the counter
MaxMatrixCols (normal value = 10), which you can change if necessary
using LATEX’s \setcounter or \addtocounter commands.


So you need:

\setcounter{MaxMatrixCols}{20}
\begin{align}
\mathbf{x}=
\begin{pmatrix}
1 & 1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\
1 & 1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0\\
1 & 1 & 0 & 1 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0\\
1 & 0 & 1 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0\\
\end{pmatrix}^\mathrm{T},
\end{align}


(You seem to have only 16 columns, but gave you an extra 4 just in case:)