0

How can I add banded colored rows to this table format ?

\documentclass{minimal}
\begin{document}
\begin{tabular}{ | p{3.40cm} | *{5}{p{1.8cm}|}  \hline
\ & \b{Title} & \b{Title} & \b{Title} & \b{Title} & \b{Title}  \\
\hline
\hline
\multicolumn{6}{|l|}{subhead} \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline
\hline
\end{tabular}
\end{document}
Leucippus
  • 1,636
  • Like this? https://tex.stackexchange.com/a/5365/121944 – AML Apr 27 '18 at 13:20
  • Also your tabular line should read \begin{tabular}{ | p{3.40cm} | *{5}{p{1.8cm}}|} \hline. I.e., you're missing a } after 1.8cm. – AML Apr 27 '18 at 13:42

1 Answers1

0

Here are banded rows, thanks to this answer and use of xcolor package:

\documentclass{minimal}
\usepackage[table]{xcolor}    % loads also »colortbl«
\begin{document}
\rowcolors{2}{gray!25}{white}
\begin{tabular}{ | p{3.40cm} | *{5}{p{1.8cm}}|}  \hline
\rowcolor{gray!50} % comment out if you don't want top row colored
\ & \b{Title} & \b{Title} & \b{Title} & \b{Title} & \b{Title}  \\
\hline
\hline
\multicolumn{6}{|l|}{subhead} \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline {text} & {text} & {text} & {text} & {text} & {text}  \\
\hline
\hline
\end{tabular}
\end{document}

enter image description here

AML
  • 2,265