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.
Best Answer
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.