Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} 
share|improve this question
    
You're missing the final \\ in the block. –  egreg Nov 10 '11 at 15:13
add comment

1 Answer

up vote 8 down vote accepted

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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