[Tex/LaTex] xcolor package; color multirows

colormultirowtables

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.

Best Answer

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].

enter image description here

\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}