11

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:} & [email protected] &  & \\
\hline \hline
\textbf{Date:} & 21.3.2011 & \textbf{Student ID:} & 3836127\\
\end{tabular}

\end{document}  

1 Answer 1

8

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:} & [email protected] & \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.

2
  • 15
    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:} & [email protected] & \multirow{-2}{}{\textbf{Name:}} & \multirow{-2}{}{MyName} \` Commented Mar 21, 2011 at 14:46
  • Thanks @Gonzalo. I don't know multirow very well and therefore went for \raisebox. Commented Mar 21, 2011 at 14:49

You must log in to answer this question.