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.

I have a simple table with 2 multirow cells. However when I apply background color, it covers the lower portion of the multirow cells and cuts through the middle of my text entry which is obviously not what I want. Can someone please tell me what I'm doing wrong here? Also notice that I'm using \vspace to move my text entry 1mm up in the multirow cells because it wasn't centered. It was closer to the lower border. There is probably a better way of doing this. Below is my code and output table that I'm getting with it:enter image description here

\documentclass[12pt]{article}

\usepackage{latexsym,amssymb}
\usepackage{colortbl}
\usepackage[margin=1in,headsep=2.5cm]{geometry}
\usepackage{multirow}

\definecolor{mycolor}{rgb}{0.92,0.95,0.86}
\arrayrulecolor{white}

\setlength{\parindent}{0pt}
\setlength{\doublerulesep}{2pt}
\setlength{\extrarowheight}{3pt}

\begin{document}

\begin{tabular}
{ >{\columncolor{mycolor}}b{79pt}
>{\columncolor{mycolor}}b{145pt}|| 
>{\columncolor{mycolor}}b{79pt}
>{\columncolor{mycolor}}b{145pt} }
\multicolumn{2}{>{\cellcolor{mycolor}}l||}{\textbf{STUDENT DATA}}& 
\multirow{2}{*}{{\vspace{-1mm}\textbf{Name:}}} & \multirow{2}{*}{\vspace{-1mm}MyName}\\
\textbf{E-mail:} & test@example.com &  & \\
\hline \hline
\textbf{Date:} & 21.3.2011 & \textbf{Student ID:} & 3836127\\
\end{tabular}

\end{document}  
share|improve this question

1 Answer 1

up vote 5 down vote accepted

This is because the lower cells of the \multirow are filled after the text was typeset. To solve this you need to place the text in the lower cells and raise it, e.g. using \raisebox:

\documentclass[12pt]{article}

\usepackage{latexsym,amssymb}
\usepackage{colortbl}
\usepackage[margin=1in,headsep=2.5cm]{geometry}
\usepackage{multirow}

\definecolor{mycolor}{rgb}{0.92,0.95,0.86}
\arrayrulecolor{white}

\setlength{\parindent}{0pt}
\setlength{\doublerulesep}{2pt}
\setlength{\extrarowheight}{3pt}

\begin{document}

\begin{tabular}
{ >{\columncolor{mycolor}}b{79pt}
>{\columncolor{mycolor}}b{145pt}|| 
>{\columncolor{mycolor}}b{79pt}
>{\columncolor{mycolor}}b{145pt} }
\multicolumn{2}{>{\cellcolor{mycolor}}l||}{\textbf{STUDENT DATA}}&&\\
\textbf{E-mail:} & test@example.com & \raisebox{1.6ex}[1.6ex]{\textbf{Name:}} & \raisebox{1.6ex}[1.6ex]{MyName}\\
\hline \hline
\textbf{Date:} & 21.3.2011 & \textbf{Student ID:} & 3836127\\
\end{tabular}

\end{document} 

Please also make sure to provide minimal examples. Half the code here is not required to demonstrate the issue and therefore finding the issue takes longer as necessary.

share|improve this answer
8  
You can avoid the use of \raisebox by placing the \multirow commands in the last row, and using a negative first argument: `\multicolumn{2}{>{\cellcolor{mycolor}}l||}{\textbf{STUDENT DATA}} & & \\textbf{E-mail:} & test@example.com & \multirow{-2}{}{\textbf{Name:}} & \multirow{-2}{}{MyName} \` –  Gonzalo Medina Mar 21 '11 at 14:46
    
Thanks @Gonzalo. I don't know multirow very well and therefore went for \raisebox. –  Martin Scharrer Mar 21 '11 at 14:49

Your Answer

 
discard

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