3

I've had a persistent error that appears with the following MWE (generated using TablesGenerator.comand tested with Texpad). The error ‘Undefined control sequence. \cellcolor’ does not appear to be due to TablesGenerator.com, but with the 'colortbl' LaTeX package. Several postings on StackExchange et al. point to the error occurring when using an outdated version of the ‘colortbl’ package. I have triple checked that I am using the latest version of the ‘colortbl’ package [2020/01/04 v1.0e Color table columns (DPC)] by David Carlisle. Yet, the error ‘Undefined control sequence. \cellcolor’ persists. Any help to discern what is causing the error would be greatly appreciated.

\documentclass{memoir}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\begin{longtable}[c]{
>{\columncolor[HTML]{FDD}}l 
>{\columncolor[HTML]{FDD}}l 
>{\columncolor[HTML]{C5C5C5}}l ll}
\hline
\cellcolor[HTML]{FDD}                                  & \multicolumn{2}{l}{\cellcolor[HTML]{FDD}\textbf{Amount (Gt carbon; 1 Gt = 1015 g)}} &  &  \\ \cline{2-5} 
\multirow{-2}{*}{\cellcolor[HTML]{FDD}\textbf{Region}} & \textbf{Before anthropogenic change}      & \textbf{After anthropogenic change}     &  &  \\ \cline{1-1}
\endfirsthead
%
\multicolumn{5}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\cellcolor[HTML]{FDD}                                  & \multicolumn{2}{l}{\cellcolor[HTML]{FDD}\textbf{Amount (Gt carbon; 1 Gt = 1015 g)}} &  &  \\ \cline{2-5} 
\multirow{-2}{*}{\cellcolor[HTML]{FDD}\textbf{Region}} & \textbf{Before anthropogenic change}      & \textbf{After anthropogenic change}     &  &  \\ \cline{1-1}
\endhead
%
\hline
\endfoot
%
\endlastfoot
%
land plants                                            & 610                                       & 550                                     &  &  \\
soil and humus                                         & 1,500                                     & \cellcolor[HTML]{FDD}no change          &  &  \\
atmosphere                                             & 600                                       & 750 (+3.4 per annum)                    &  &  \\
upper ocean                                             & 1,000                                     & 1,020 (+0.4 per annum)                  &  &  \\
marine life                                            & 3                                         & \cellcolor[HTML]{FDD}no change          &  &  \\
dissolved organic carbon                               & 700                                       & \cellcolor[HTML]{FDD}no change          &  &  \\
mid-depth and deep ocean                               & 38,000                                    & 38,100 (+1.6 per annum)                 &  &  \\ \hline
\caption{The separation between the fast-carbon and slow-carbon timescales has been significantly disturbed through the burning of fossil fuel.  The following tables give some current estimates for the carbon budget and the carbon flux budget.}
\label{tab:The-carbon-budget-table}\\
\end{longtable}
\end{document}
1
  • @DavidCarlisle - I replaced all occurrences of FDD with FFDDDD and it Worked! Thank you! So the TablesGenerator.com generated table WAS the issue! I tried to send a message to TablesGenerator.com people to let them know, but the message would not go through ... hopefully they'll see this and correct their coding to work properly with xcolor's HTML color model conversion. Dec 17, 2020 at 13:06

1 Answer 1

3

The error is not that \cellcolor is undefined but \@@scl

! Undefined control sequence.
<argument> \@@scl 
\XC@cnv@HTML ...TML@ \@@tmp \edef \@@scl {\@cclv }

which comes from xcolor's HTML color model conversion

A more minimal example (with the advantage of not using any of my packages)


\documentclass{article}
\usepackage{xcolor}
\definecolor{zzz}{HTML}{FDD}
\begin{document}
\end{document}

producing

! Undefined control sequence.
<argument> \@@scl 
                  
l.4 \definecolor{zzz}{HTML}{FDD}
                                
? 

the xcolor manual says

HTML accepts any combination of the characters 0–9, A–F, a–f, as long as the string has a length of exactly 6 characters.

ie the 3-digit form is not supported FFDDDD works without error.

2
  • Interesting David, your suggesting didn't work. Infact it has been there all long in the definitions. Any further tips?
    – bonCodigo
    Feb 15, 2023 at 4:37
  • @bonCodigo I do not understand. make a real example and post a new question Feb 15, 2023 at 8:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .