3

I would like a table where the background of the first line is gray and the background of the rest of the table is white. The problem is that the table has a double column line. I have tried \doublerulesepcolor but it allows me to put color between the two column lines for ALL the table and not for just the first line.

\documentclass{report}
\usepackage{colortbl}
\begin{document}

\begin{verbatim}
\definecolor{Lightgray}{gray}{.80}
\doublerulesepcolor{Lightgray}
 \begin{tabular}[t]{|c|c||c|}\hline
 \rowcolor[gray]{.8} CityFrom & CityTo & Count\\\hline
 \doublerulesepcolor{white}
 a & c & 2\\
 a & e & 1\\\hline
\end{tabular}
\end{verbatim}

\begin{center}
\definecolor{Lightgray}{gray}{.80}
\doublerulesepcolor{Lightgray}
 \begin{tabular}[t]{|c|c||c|}\hline
 \rowcolor[gray]{.8} CityFrom & CityTo & Count\\\hline
 \doublerulesepcolor{white}
 a & c & 2\\
 a & e & 1\\\hline
 \end{tabular}
\end{center}

While trying to solve the problem I realized that \verb+\arrayrulecolor+ can be changed at each line
but this not the case with \verb+\doublerulesepcolor+

\begin{verbatim}
\definecolor{Lightgray}{gray}{.80}
\setlength\arrayrulewidth{2pt}
\doublerulesepcolor{Lightgray}
 \begin{tabular}[t]{|c|c||c|}\hline
 \rowcolor[gray]{.8} CityFrom & CityTo & Count\\\hline
 \arrayrulecolor{red}\doublerulesepcolor{red}
 a & c & 2\\
 \arrayrulecolor{blue}\doublerulesepcolor{blue} 
 a & e & 1\\\hline
 \end{tabular}
\end{verbatim}

\begin{center}
\definecolor{Lightgray}{gray}{.80}
\setlength\arrayrulewidth{2pt}
\doublerulesepcolor{Lightgray}
 \begin{tabular}[t]{|c|c||c|}\hline
 \rowcolor[gray]{.8} CityFrom & CityTo & Count\\\hline
 \arrayrulecolor{red}\doublerulesepcolor{red}
 a & c & 2\\
 \arrayrulecolor{blue}\doublerulesepcolor{blue} 
 a & e & 1\\\hline
 \end{tabular}
\end{center}

What is needed is that \verb+\doublerulesepcolor+ has a ``local" behavior as \verb+\arrayrulecolor+.

Any hint how to obtain this ?

Regards

Esteban

\end{document}
2

Er, sorry, this appears to be an undocumented feature.

Add this to the document preamble

\makeatletter
\let\old@mkpream\@mkpream
\def\@mkpream{%
\ifx\CT@drsc@\relax\else\let\CT@drsc@ @\fi
\let\CT@arc@\relax
\old@mkpream}
\makeatother

enter image description here

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.