1

I'm new using latex and I want to do a colored table for my work. I have the following code:

\documentclass[11pt, oneside]{book}
\usepackage[table]{xcolor}
\usepackage{hhline}
\newcommand{\x}{\cellcolor[gray]{0.8}}
\usepackage{multirow}
\usepackage{rotating}
\usepackage{colortbl}

\begin{document}
\begin{table}[h!]
\caption{List of proposed tasks \label{table_tasks}}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\cline{3-8}
\multicolumn{1}{c}{} & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{F1} & \multicolumn{3}{c|}{F2}\\
\cline{3-8}
\multicolumn{1}{c}{} & \multicolumn{1}{c|}{} & A1 & A2 & A3 & B1 & B2 & B3\\
\hline
\multicolumn{1}{|c|}{\multirow{8}{*}{\rotatebox[origin=c]{90}{Year 1}}} & M &\x & \x & \x & & &\\
\cline{2-8}
& J &\x & \x & \x & & &\\
\cline{2-8}
& J &\x & \x & \x & & &\\
\cline{2-8}
& A &   &    & \x & & &\\
\cline{2-8}
& S &   &    & \x & & &\\
\cline{2-8}
& O &   &    &    & \x & \x & \\
\cline{2-8}
& N &   &    &    & \x & \x & \\
\cline{2-8}
& D &   &    &    & \x & \x & \\
\hline
\multicolumn{1}{|c|}{\multirow{12}{*}{\rotatebox[origin=c]{90}{Year 2}}} & J &   &    &    & \x & \x & \\
\cline{2-8}
& F &   &    &    & \x & \x & \\
\cline{2-8}
& M &   &    &    &  &  & \x \\
\cline{2-8}
& A &   &    &    &  &  & \x \\
\cline{2-8}
& M &   &    &    &  &  & \x \\
\cline{2-8}
& J &   &    &    &  &  & \x \\
\cline{2-8}
& J &   &    &    &  &  & \x \\
\cline{2-8}
& A &   &    &    &  &  & \x \\
\cline{2-8}
& S &   &    &    &  &  & \x \\
\cline{2-8}
& O &   &    &    &  &  & \x \\
\cline{2-8}
& N &   &    &    &  &  & \x \\
\cline{2-8}
& D &   &    &    &  &  & \x \\
\cline{2-8}
\hline
\end{tabular}
\end{center}
\end{table}

\end{document}

The problem is when I use \cellcolor, color overwrites the table borders. What should I do to fix this problem? I would try using \hhline, but I don't understand the command when I want to color between two or more cells. Thanks in advance

cgnieder
  • 66,645
Mathias
  • 79
  • the colortbl documentation explictly says that \cline should not be used with coloured tables, it will be obscured by the coloured panels. – David Carlisle May 01 '17 at 07:59
  • @TeXnician not really that one but perhaps https://tex.stackexchange.com/questions/101249/colored-tables-and-cline-hhline – David Carlisle May 01 '17 at 08:07
  • @DavidCarlisle Was hard to decide. But I thought that the "simple solution" thing would be more helpful effectively. – TeXnician May 01 '17 at 08:10
  • But If I want to color between the cell 2 and cell 3, for example, what I have to do with the command /hhline? I don't understand the command – Mathias May 01 '17 at 13:28

0 Answers0