1

I'm using the following documentclass and preamble

\documentclass[runningheads]{llncs}
%
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage{svg}
\usepackage{subfig}

I'm using this website to generate a table in latex like the following :

enter image description here

I get the following conversion:

% Please add the following required packages to your document preamble:
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[]
\begin{tabular}{
>{\columncolor[HTML]{FFF}}r 
>{\columncolor[HTML]{FFF7F3}}r rr
>{\columncolor[HTML]{FFF7F3}}r 
>{\columncolor[HTML]{FFF7F3}}r rrr}
\textbf{}   & \cellcolor[HTML]{FFF}\textbf{LT}                    & \cellcolor[HTML]{FFF}\textbf{LD}                    & \cellcolor[HTML]{FFF}\textbf{FK}                    & \cellcolor[HTML]{FFF}\textbf{BD}                    & \cellcolor[HTML]{FFF}\textbf{AZ}                    & \cellcolor[HTML]{FFF}\textbf{BF}                    & \cellcolor[HTML]{FFF}\textbf{BK}                    & \cellcolor[HTML]{FFF}\textbf{OB}                    \\
\textbf{AG} & 0.01                                                & \cellcolor[HTML]{FCC8C3}0.2                         & \cellcolor[HTML]{E23E99}{\color[HTML]{F1F1F1} 0.05} & 0.02                                                & nan                                                 & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.04} & \cellcolor[HTML]{F994B1}0.04                        & \cellcolor[HTML]{F767A1}0.05                        \\
\textbf{KZ} & 0.01                                                & \cellcolor[HTML]{F873A5}0.25                        & \cellcolor[HTML]{99017B}{\color[HTML]{F1F1F1} 0.06} & \cellcolor[HTML]{FCC5C0}0.03                        & 0.01                                                & \cellcolor[HTML]{F769A1}0.03                        & \cellcolor[HTML]{99017B}{\color[HTML]{F1F1F1} 0.06} & \cellcolor[HTML]{FFF7F3}0.04                        \\
\textbf{AZ} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.02} & \cellcolor[HTML]{F25D9F}0.26                        & \cellcolor[HTML]{99017B}{\color[HTML]{F1F1F1} 0.06} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.06} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.07} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.04} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.07} & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.06} \\
\textbf{FT} & 0.01                                                & \cellcolor[HTML]{FBBABD}0.21                        & \cellcolor[HTML]{E23E99}{\color[HTML]{F1F1F1} 0.05} & 0.02                                                & nan                                                 & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.04} & \cellcolor[HTML]{F994B1}0.04                        & \cellcolor[HTML]{F767A1}0.05                        \\
\textbf{BK} & 0.01                                                & \cellcolor[HTML]{FCC8C3}0.2                         & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.07} & \cellcolor[HTML]{F767A1}0.04                        & nan                                                 & \cellcolor[HTML]{F769A1}0.03                        & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.07} & \cellcolor[HTML]{FFF7F3}0.04                        \\
\textbf{OB} & 0.01                                                & \cellcolor[HTML]{FFF7F3}0.15                        & \cellcolor[HTML]{E23E99}{\color[HTML]{F1F1F1} 0.05} & 0.02                                                & nan                                                 & \cellcolor[HTML]{FFF7F3}0.02                        & \cellcolor[HTML]{E23E99}{\color[HTML]{F1F1F1} 0.05} & \cellcolor[HTML]{F767A1}0.05                        \\
\textbf{HL} & 0.01                                                & \cellcolor[HTML]{E84A9B}0.27                        & \cellcolor[HTML]{FFF7F3}0.02                        & 0.02                                                & nan                                                 & \cellcolor[HTML]{F769A1}0.03                        & \cellcolor[HTML]{FFF7F3}0.02                        & \cellcolor[HTML]{FFF7F3}0.04                        \\
\textbf{SD} & 0.01                                                & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.36} & \cellcolor[HTML]{99017B}{\color[HTML]{F1F1F1} 0.06} & 0.02                                                & nan                                                 & \cellcolor[HTML]{49006A}{\color[HTML]{F1F1F1} 0.04} & \cellcolor[HTML]{99017B}{\color[HTML]{F1F1F1} 0.06} & \cellcolor[HTML]{F767A1}0.05                       
\end{tabular}
\end{table}

I get error similar to the following:

<argument> \@@scl 
                  
l.144 \textbf{}   &
                    \cellcolor[HTML]{FFF}\textbf{LT}                    & \c...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
                   \@cclv 
l.144 \textbf{}   &
                    \cellcolor[HTML]{FFF}\textbf{LT}                    & \c...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
1
  • FFF is not a valif color in the HTML color model. To get white, you might want to use FFFFFF instead (or \cellcolor{white}).
    – leandriis
    Aug 7, 2020 at 5:52

1 Answer 1

1

FFF is not a valid color in the HTML color model. To get a white-colored cell, use FFFFFF instead. To improve the readability of your code and in order to make changes to the colors easier, I have defined the set of used colors in the preamble and accessed them in the table via their names. If you later on want to change the color, all cells sharing the same color will automatically adapt without having to change each and every \cellcolor command.

Side note: Some of the colors are extremely similar and quite hard to distinguish. Is that intentional?

enter image description here

\documentclass[runningheads]{llncs}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\usepackage{svg}
\usepackage{subfig}
\usepackage{array}

\definecolor{mybeige}{HTML}{FFF7F3}
\definecolor{myoffwhite}{HTML}{F1F1F1}
\definecolor{mydarkpurple}{HTML}{49006A}
\definecolor{mypurple}{HTML}{99017B}
\definecolor{mydarkpink}{HTML}{E23E99}
\definecolor{mypink}{HTML}{F767A1}
\definecolor{mypink2}{HTML}{F769A1}
\definecolor{mylightpink}{HTML}{F994B1}
\definecolor{mysalmon}{HTML}{FCC8C3}
\definecolor{mylightsalmon}{HTML}{FBBABD}

\begin{document}
\begin{table}[]
\begin{tabular}{
>{\columncolor{white}}r 
>{\columncolor{mybeige}}r rr
>{\columncolor{mybeige}}r 
>{\columncolor{mybeige}}r rrr}
\textbf{}   & \cellcolor{white}\textbf{LT}                        & \cellcolor{white}\textbf{LD}                      & \cellcolor{white}\textbf{FK}                      & \cellcolor{white}\textbf{BD}                      & \cellcolor{white}\textbf{AZ}                      & \cellcolor{white}\textbf{BF}                      & \cellcolor{white}\textbf{BK}                      & \cellcolor{white}\textbf{OB}                      \\
\textbf{AG} & 0.01                                                & \cellcolor{mysalmon}0.2                           & \cellcolor{mydarkpink}{\color{myoffwhite} 0.05}   & 0.02                                              & nan                                               & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.04} & \cellcolor{mylightpink}0.04                       & \cellcolor{mypink}0.05                            \\
\textbf{KZ} & 0.01                                                & \cellcolor[HTML]{F873A5}0.25                      & \cellcolor{mypurple}{\color{myoffwhite} 0.06}     & \cellcolor[HTML]{FCC5C0}0.03                      & 0.01                                              & \cellcolor{mypink2}0.03                           & \cellcolor{mypurple}{\color{myoffwhite} 0.06}     & \cellcolor{mybeige}0.04                           \\
\textbf{AZ} & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.02}   & \cellcolor[HTML]{F25D9F}0.26                      & \cellcolor{mypurple}{\color{myoffwhite} 0.06}     & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.06} & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.07} & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.04} & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.07} & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.06} \\
\textbf{FT} & 0.01                                                & \cellcolor{mylightsalmon}0.21                     & \cellcolor{mydarkpink}{\color{myoffwhite} 0.05}   & 0.02                                              & nan                                               & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.04} & \cellcolor{mylightpink}0.04                       & \cellcolor{mypink}0.05                            \\
\textbf{BK} & 0.01                                                & \cellcolor{mysalmon}0.2                           & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.07} & \cellcolor{mypink}0.04                            & nan                                               & \cellcolor{mypink2}0.03                           & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.07} & \cellcolor{mybeige}0.04                           \\
\textbf{OB} & 0.01                                                & \cellcolor{mybeige}0.15                           & \cellcolor{mydarkpink}{\color{myoffwhite} 0.05}   & 0.02                                              & nan                                               & \cellcolor{mybeige}0.02                           & \cellcolor{mydarkpink}{\color{myoffwhite} 0.05}   & \cellcolor{mypink}0.05                            \\
\textbf{HL} & 0.01                                                & \cellcolor[HTML]{E84A9B}0.27                      & \cellcolor{mybeige}0.02                           & 0.02                                              & nan                                               & \cellcolor{mypink2}0.03                           & \cellcolor{mybeige}0.02                           & \cellcolor{mybeige}0.04                           \\
\textbf{SD} & 0.01                                                & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.36} & \cellcolor{mypurple}{\color{myoffwhite} 0.06}     & 0.02                                              & nan                                               & \cellcolor{mydarkpurple}{\color{myoffwhite} 0.04} & \cellcolor{mypurple}{\color{myoffwhite} 0.06}     & \cellcolor{mypink}0.05                       
\end{tabular}
\end{table}
\end{document}

You must log in to answer this question.

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