3

I've been trying to colour single cells but it's not working. Here's a MWE:

\documentclass{memoir}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}

\begin{document}

\begin{tabular}{|l|c|}
\cellcolor{Green}one and  & two      \\
\rowcolor{Green}three and & four and \\
\end{tabular}

\end{document}

The \rowcolor command works fine (as do all other colortbl commands) but \cellcolor never works. The error I get is 'unknown command name'. I've tried this with article.cls as well, so it's not an incompatibility with memoir. My workaround has been to use the \columncolor command with \multicolumn{1}. I've updated all packages on my system to the latest versions.

Edit: I'm running TeXlive 2013 under OS X 10.9 (Mavericks) and have recently updated all changed packages via TeX Live Utility.

package version information (via \listfiles):

memoir.cls    2013/05/30 v3.7b configurable book, report, article document class
ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
ifetex.sty    2011/12/15 v1.2 ifetex
ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
mem10.clo    2008/01/30 v0.3 memoir class 10pt size option
mempatch.sty    2009/07/24 v6.0f Patches for memoir class v1.6180339
xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
colortbl.sty    1999/03/24 v0.1i Color table columns (DPC)
dvipsnam.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
svgnam.def    2007/01/21 v2.11 Predefined colors according to SVG 1.1 (UK)
supp-pdf.mkii

And here's the error message I get:

! Undefined control sequence.
l.25 \cellcolor
           {Green}one and &two\\
The control sequence at the end of the top line of your error message was never     
\def'ed.
  • 1
    @PrzemysławScherwentke: \usepackage[table]{xcolor} loads colortbl. – Werner Nov 30 '13 at 4:28
  • This works fine on my machine (TL 2013). We're gonna have to see what version of the files you're running. See Which package version am I using? – Werner Nov 30 '13 at 4:30
  • Thanks @Werner, I've added the version info as you suggested. Just to reiterate, I updated all changed packages yesterday. – Gaston Ümlaut Nov 30 '13 at 5:00
  • Thanks to @Werner for pointing me in the right direction by making me look carefully at the version dates of the packages, it's enabled me to figure out the answer myself. I'll provide an answer shortly. – Gaston Ümlaut Nov 30 '13 at 5:17
  • 1
    Your colortbl (version 0.1i) is heavily outdated. The latest version should be 1.0a. It may be that you have a local copy somewhere in your TeXMF tree, or in your working folder. Delete this and things should be good. – Werner Nov 30 '13 at 5:18
5

The key to finding the solution was provided by @Werner, who suggested I use the \listfiles command to check the versions of my packages. I had assumed these would all be correct as I had recently done an update with Tex Live Utility. However it turns out that I had an old version of colortbl in my local folder and this took precedence over the TL 2013 version. Deleting this old file fixed my problem.

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.