[Tex/LaTex] Error with blkarray: Misplaced \noalign

arrays

I am trying to write a matrix with indices given to the rows and columns. I get the error "Misplaced \noalign." Does anybody understand why? The minimal example is below.

\documentclass{minimal}
\usepackage{blkarray}
\begin{document}

\[
\begin{blockarray}{ccccc}
      & A & B & C & D\\
    \begin{block}{c[cccc]}
    A & 1 & 1 & 1 & 1\\ 
    B & 1 & 0 & 0 & 1\\
    C & 1 & 0 & 1 & 1\\
    D & 1 & 1 & 1 & 0
    \end{block}
  \end{blockarray}
\]

\end{document} 

Best Answer

There's an end of line \\ missing at the end of the block:

Further, the example doesn't run with the minimal class, since the command \footnotesize is required by blkarray, it requires that command for table notes support.

\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[
\begin{blockarray}{ccccc}
      & A & B & C & D\\
    \begin{block}{c[cccc]}
    A & 1 & 1 & 1 & 1\\ 
    B & 1 & 0 & 0 & 1\\
    C & 1 & 0 & 1 & 1\\
    D & 1 & 1 & 1 & 0\\
    \end{block}
  \end{blockarray}
\]
\end{document} 

block array example

Related Question