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} 
1
  • 2
    You're missing the final \\ in the block.
    – egreg
    Nov 10, 2011 at 15:13

1 Answer 1

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

4
  • Thanks for this quick answer! Testing buggy code with the minimal class is not a very good idea...
    – Bruno
    Nov 10, 2011 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, 2011 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, 2011 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, 2011 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.