Hi everyone,
I use the command \cellcolor provided by the package colortbl to color some table cells using a gray scale. The problem is, even though I pute rules in the table using \cline, these are not show in some cells.
I attach a small example (.tex) together with the pdf file that ilustrates the problem.
Any hints on how to solve this are appreciated.
Graphics, Figures & Tables ⇒ \cellcolor colors over table rules
\cellcolor colors over table rules
- Attachments
-
- example.zip
- (18.09 KiB) Downloaded 237 times
Last edited by sk on Wed Sep 22, 2010 1:59 pm, edited 1 time in total.
\cellcolor colors over table rules
Don't use \cline, but \hhline from hhline package:
Take a look at hhline package documentation for more infos.
Code: Select all
\documentclass[a4paper, 11pt]{article}
\usepackage{colortbl}
\usepackage{hhline}
\usepackage{multirow}
\begin{document}
\begin{table}[!h]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline
Column1 & Column2 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\ \hline
\multirow{2}{*}{Rows}
& Row1 & & & & & & & & & & & \\ \cline{2-13}
& Row2 & & & & & & & & & & & \\ \hline
\multirow{2}{*}{More rows}
& Row3 & & & & & & & & & & & \\ \cline{2-13}
& Row4 & & & & & & & & & & & \\ \hline
\end{tabular}
\caption{This table has all the rules...}
\end{table}
\begin{table}[!h]
\arrayrulecolor{blue}
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline
\cellcolor[gray]{0.9} Column1 & \cellcolor[gray]{0.9} Column2 & \cellcolor[gray]{0.9} 1 & \cellcolor[gray]{0.9}2 & \cellcolor[gray]{0.9}3 & \cellcolor[gray]{0.9}4 & \cellcolor[gray]{0.9}5 & \cellcolor[gray]{0.9}6 & \cellcolor[gray]{0.9}7 & \cellcolor[gray]{0.9}8 &\cellcolor[gray]{0.9} 9 & \cellcolor[gray]{0.9}10 & \cellcolor[gray]{0.9}11 \\ \hline
\multirow{2}{*}{Rows}
& Row1 & & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & & & & & & & & \\ \hhline{~------------}
& Row2 & & & & \cellcolor[gray]{0.5} & & & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & & & \\ \hline
\multirow{2}{*}{More rows}
& Row3 & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} \\ \hhline{|~|-|-|-|-|-|-|-|-|-|-|-|-|}
& Row4 & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & \cellcolor[gray]{0.5} & & \cellcolor[gray]{0.5} \\ \hline
\end{tabular}
\caption{...but this one doesn't}
\end{table}
\end{document}
-
- Posts: 351
- Joined: Sat Aug 02, 2008 8:47 am
\cellcolor colors over table rules
it is only a problem with the viewer. Print it and comparesk wrote:Hi everyone,
I use the command \cellcolor provided by the package colortbl to color some table cells using a gray scale. The problem is, even though I pute rules in the table using \cline, these are not show in some cells.
I attach a small example (.tex) together with the pdf file that ilustrates the problem.
Any hints on how to solve this are appreciated.
the output.
Herbert
Re: \cellcolor colors over table rules
I thought about the viewer issue but then I printed and not all of them are OK. For example, al the cells in rows 3 and 4 that are colored in both rows do not have a rule.
I will try the hhline package.
EDIT: It seems to be working fine with hhline, I will print and then I will update the post if everything is OK
EDIT2: Printed also looks good. Thanks
I will try the hhline package.
EDIT: It seems to be working fine with hhline, I will print and then I will update the post if everything is OK
EDIT2: Printed also looks good. Thanks