3

I want to draw a simple colored table with 4 columns. First row is a multicolumn row which spans columns one and two. There is one doublespace between columns 2 and 3. When i apply color (blue in this case) to multicolumn 1&2 it actually crosses the doublerule separator which is not what I want.

Any ideas how to solve this?

Here is the code which produces the table.

\documentclass[12pt]{article}

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

\setlength{\textwidth}{500pt}
\setlength{\parindent}{0pt}
\setlength{\doublerulesep}{4pt}
\setlength{\extrarowheight}{3pt}

\begin{document}
    \begin{tabular}
        { >{\columncolor[gray]{0.8}}b{79pt}
            >{\columncolor[gray]{0.8}}b{145pt}||
            >{\columncolor[gray]{0.8}}b{79pt} 
            >{\columncolor[gray]{0.8}}b{145pt}  }
        \multicolumn{2}{>{\cellcolor{blue}}l}{SOME TEXT GOES HERE}& & \\ 
        \textbf{E-mail:} & test@example.com & \textbf{Name:} & My Name\\ \hline \hline
        \textbf{Date:} & 18.3.2011 & \textbf{ID number:} & 1234567
    \end{tabular}
\end{document}

result

  • I added a picture (and you should have enough reputation for pictures now). – Caramdir Mar 18 '11 at 17:51
1

You have to add || at the end of the second argument of \multicolumn as well.

\documentclass[12pt]{article}

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

\setlength{\textwidth}{500pt}
\setlength{\parindent}{0pt}
\setlength{\doublerulesep}{4pt}
\setlength{\extrarowheight}{3pt}

\begin{document}
\begin{tabular}
{ >{\columncolor[gray]{0.8}}b{79pt}
  >{\columncolor[gray]{0.8}}b{145pt}||
  >{\columncolor[gray]{0.8}}b{79pt} 
  >{\columncolor[gray]{0.8}}b{145pt}  }
\multicolumn{2}{>{\cellcolor{blue}}l||}{SOME TEXT GOES HERE}& & \\    \textbf{E-mail:} & test@example.com & \textbf{Name:} & My Name\\    \hline \hline
\textbf{Date:} & 18.3.2011 & \textbf{ID number:} & 1234567\\    \end{tabular}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy