TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}$$ 
share|improve this question
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
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} – Jubobs Mar 21 '14 at 23:20
@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
up vote 7 down vote accepted

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.

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