I never ran into the following problem before, where every time I tried to use matrices, LaTeX generated an error;

!undefined control sequence.

I was very puzzled as to how does this error come about. Did I use something that I should not be using?

$$\begin{bmatrix} 1 & 2 \\ \end{bmatrix}$$ 
  • 2
    The problem seems to be with the colortbl package; your example works without it. I'm not yet sure why this is though. – Ian Thompson Mar 21 '14 at 23:17
  • 1
    Your code is far from being minimal. You should remove packages one by one in order to isolate the problem. If you do that, you end up with this Minimal non-Working Example: \documentclass{revtex4} \usepackage{amsmath} \usepackage{colortbl} \begin{document} $$\begin{bmatrix} 1 & 2 \\ \end{bmatrix}$$\end{document} – jub0bs Mar 21 '14 at 23:20
  • 1
    @IanThompson what a thing to say:-) Try changing revtex4 to article and you'll see it works:-) – David Carlisle Mar 21 '14 at 23:28
  • @DavidCarlisle --- it's Friday and I've had a few beers. Otherwise I would have known that the blame lay elsewhere. – Ian Thompson Mar 21 '14 at 23:44

If I strip out most of the custom commands and package loading, then this is what I’m left with which still shows the problem:




1 & 2 \\


The problem seems to arise as a conflict between the revtex4 class and the colortbl package. Removing either one (either not loading colortbl, or using the article class) makes the problem go away.

There’s an answer by David Carlisle (who wrote colortbl) involving these two which is using the revtex4-1 class. I assume this is a similar but slightly newer version of revtex4. I find that using that makes the problem go away, so I’d recommend using that class if you can.

If not, wait until somebody who knows these packages/classes better to explain where the conflict lies, and what a suitable workaround might be.

  • I think that revtex4-1 is intended as a replacement for all uses of revtex4, and it fixes this so I think that's the full answer. – David Carlisle Mar 21 '14 at 23:32

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.