Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
To define your own color in RGB simply use \definecolor{somegrey}{RGB}{128,128,128}. –  xfoo Jan 3 '13 at 15:14
add comment

1 Answer 1

up vote 7 down vote accepted

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}
share|improve this answer
    
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 '13 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 '13 at 21:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.