4

When I use \rowcolor, custom separators between columns are not affected:

\documentclass{article}

\usepackage{xcolor}
\usepackage{colortbl}

\begin{document}
    \begin{tabular}{p{1cm}!{-}p{1cm}}
        \rowcolor{gray} foo & bar
    \end{tabular}
\end{document}

The - is rendered with white background, although the whole row should be gray. How can I fix that?

4

A couple of possibilities. Sorry the interface is rubbish, it's not entirely my fault.

enter image description here

\documentclass{article}

\usepackage{xcolor}
\usepackage{colortbl}

\begin{document}
    \begin{tabular}{p{1cm}!{-}p{1cm}}
        \rowcolor{gray} foo & bar
    \end{tabular}

\bigskip

    \begin{tabular}{p{1cm}!{-}p{1cm}}
        \rowcolor{gray}
        \multicolumn{1}{p{1cm}!{\fboxsep=0pt\colorbox{gray}{\strut-}}}{foo} & bar
    \end{tabular}


\bigskip

    \begin{tabular}{p{1cm}!{-}p{1cm}}
    \rowcolor{gray}
    \multicolumn{1}{>{\columncolor{gray}[\tabcolsep][15pt]}p{1cm}!{-}}{foo}& bar
    \end{tabular}

\end{document}

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.