2

I'm trying to colour some cells in a table. I've read that I need to use the package [table]xcolor, but my file is not compiling when I insert that package, I get an undefined control sequence type of error, even without trying to colour any cells. My code is

\documentclass[aps]{revtex4}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[h!]
\begin{tabular}{c | c | c}

N & 2 & 3 \\

2 & MS & MS \\

\end{tabular}
\end{table}

\end{document}

which does not compile, but if you comment the line \usepackage[table]{xcolor}, it does compile. The error I get is very long, it starts with:

! Undefined control sequence.
\CT@setup ->\@tempdimb \col@sep 
                                \@tempdimc \col@sep \def \CT@color {\global ...
l.7 \begin{tabular}{c | c | c}
...

Any solution?

  • 1
    Welcome to TeX.SX! Any reason for using the obsolete revtex4 class instead of revtex4-1? – egreg Jun 21 '17 at 15:21
  • No, and this already solved the issue, thanks :) – user3154647 Jun 21 '17 at 15:26
1

The revtex4 class is incompatible with colortbl, because it redefines the tabular environment so \col@sep gets undefined. This is an important dimension register defined in the array package, which colortbl relies upon.

The class is, however, obsolete and remains for back compatibility. The revtex4-1 class doesn't suffer from the problem.

\documentclass[aps]{revtex4-1}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}[htp!]% <------ Never just h!
\begin{tabular}{c | c | c}

N & 2 & 3 \\

2 & MS & MS \\

\end{tabular}
\end{table}

\end{document}

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.