2

I'm trying to come up with a nicely formatted work plan as a table, but the coloring of individual cells messes completely the row coloring of the table as the following code shows:

\documentclass[10pt,a4paper]{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{booktabs}
\newcommand{\ccell}{\cellcolor{Periwinkle}}

\begin{document}

\begin{table}
  \centering
  \rowcolors{2}{gray!10}{white}
  \begin{tabular}{lrrrrrrrr}
    \toprule
    Activity & \multicolumn{8}{c}{month range} \\
     & \scriptsize{0--6} & \scriptsize{7--12} & \scriptsize{12--18} & \scriptsize{19--24} & \scriptsize{25-30} & \scriptsize{31-36} & \scriptsize{37--42} & \scriptsize{42--48} \\ 
    \toprule 
   Learn \LaTeX & \ccell \\
   Write article  & & \ccell & \ccell &\\
   Publish process  & & & & \ccell& \ccell & \ccell & \ccell \\
    \bottomrule
  \end{tabular}
\caption{Prospective work plan.}
\label{tab:work_plan}
\end{table}

\end{document}

enter image description here

I thought of using pattern instead and I found this post, but the implementation with tikz seems quite involved. I also thought that maybe it would look nicer to have only a portion of the cell with the patter to make it more subtle, but I have no idea on how to do that.

aaragon
  • 3,041

1 Answers1

2

the lack of row colour is unrelated to your \ccell macro, you would see the same with

 Learn \LaTeX &  \\

That row only has two cells and you need 9 so

 Learn \LaTeX & \ccell &&&&&&&\\
David Carlisle
  • 757,742
  • Yes, that solves the issue with the background table coloring, but still the table doesn't look right, does it? – aaragon Mar 24 '15 at 21:22
  • @aaragon it looks as I expect, you haven't said what you expect, presumably something different? – David Carlisle Mar 24 '15 at 21:47
  • Well in the title and in the body of the post I mention that it would be good to compare the coloring of the cell with having a hatched pattern. Yet, I can't seem to find an easy way to pattern the cells. – aaragon Mar 24 '15 at 22:52
  • @aaragon there is no easy way to have a pattern rather than solid colour, but since the code specifies a solid colour it produces the expected table once the error of the missing && is fixed. – David Carlisle Mar 25 '15 at 12:18