10

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} 
Moriambar
  • 11,466
Bruno
  • 1,975

1 Answers1

15

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

Moriambar
  • 11,466
Stefan Kottwitz
  • 231,401
  • Thanks for this quick answer! Testing buggy code with the minimal class is not a very good idea... – Bruno Nov 10 '11 at 16:42
  • @Bruno: What then is the point of the minimal class? It cuts out so much that it breaks packages that expect a normal document. – Ryan Reich Nov 10 '11 at 17:03
  • @RyanReich: Actually, I don't know... I was using it because the problem occurred to me in a beamer document and the errors are usually a bit tricky to localize in a beamer source. But I should have used the article class instead! – Bruno Nov 10 '11 at 22:37
  • @Bruno: Just to be clear, I wasn't criticizing you so much as wondering why this class exists. article is fairly minimal as it is. Certainly compared to beamer! – Ryan Reich Nov 10 '11 at 22:57