# xcolor package; color multirows

Consider the following table:

\documentclass[a4paper]{report}

\usepackage{multirow}
\usepackage[table]{xcolor}

\begin{document}

\begin{table}
\rowcolors{1}{gray!15}{gray!15}
\centering
\begin{tabular}{rrrrr}
\rowcolor{gray!50}
Header & 1     & 2     & 3     & 4 \\
Row1  & a     & b     & c     & d \\
\multicolumn{1}{c}{\multirow{2}[0]{*}{Multirow1}} & a1    & b1    & c1    & d1 \\
\multicolumn{1}{c}{} & a2    & b2    & c2    & d2 \\
Row2  & aa    & ab    & ac    & ad \\
\end{tabular}
\end{table}

\end{document}


What I am not happy with is the fact that "Multirow1" is now half hidden. Furthermore, instead of the colors gray!15 and gray!50 I want to use RGB values. Not sure how to do this though.

-
To define your own color in RGB simply use \definecolor{somegrey}{RGB}{128,128,128}. –  xfoo Jan 3 at 15:14

I suppose the lower cell is filled with colour after the multirow is created, hence covering up its contents. If you instead move the multirow to the lowest row, and use -2 instead of 2, it works better.

To define colours using RGB values, use either

\definecolor{<name of colour>}{rgb}{<red>, <green>, <blue>}


where <color> is in the interval [0,1], or

\definecolor{<name of colour>}{RGB}{<red>, <green>, <blue>}


where <color> is integers in the interval [0,255].

\documentclass[a4paper]{report}

\usepackage{multirow}
\usepackage[table]{xcolor}
\definecolor{MyColor}{rgb}{0.8, 0.8, 0.8}
\begin{document}

\begin{table}
\rowcolors{1}{gray!15}{gray!15}
\centering
\begin{tabular}{rrrrr}
\rowcolor{MyColor}
Header & 1     & 2     & 3     & 4 \\
Row1  & a     & b     & c     & d \\
\multicolumn{1}{c}{} & a1    & b1    & c1    & d1 \\
\multicolumn{1}{c}{\multirow{-2}[0]{*}{Multirow1}} & a2    & b2    & c2    & d2 \\
Row2  & aa    & ab    & ac    & ad \\
\end{tabular}
\end{table}

\end{document}

-
Torbjørn T., I have tried your code and my result is "Multirow1" on white background. (sorry for not sending image, but "I have not enough reputation to post image") What is wrong ? (I tried a lot of examples with \multirow and \cellcolor or \rowcolor and till now no success ...) –  Ivan Apr 27 at 21:30
Recently on texblog | because LaTeX matters a related blog post was published, that gives a short explanation: Hidden text with LaTeX colored multi-row tables. –  Speravir Apr 27 at 21:59