So I tried learning LaTeX last night, and I trying to get this template for school assignments done ASAP. Part of that requires building a table. I want to use multirow, but need the multirows, that are acting like headings, to be colored gray. This is what I created so far from the almighty Google.
\documentclass{article}
\usepackage{xcolor,colortbl}
\begin{document}
\begin{tabular}{|l|l|p{5cm}|p{2.5cm}|l|l|}
\hline
\rowcolor{lightgray}
Stage & Aim & Procedure & Materials & Focus & Time \\
\hline
\rowcolor{lightgray}
\multicolumn{6}{|l|}{Engage} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
%\hline
\rowcolor{lightgray} \multicolumn{6}{|l|}{Study} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\rowcolor{lightgray}
\multicolumn{6}{|l|}{Activate} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\rowcolor{lightgray}
\multicolumn{6}{|l|}{Conclusion} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\end{tabular}
\end{document}
Unfortunately, this does not work with pdflatex version 1.4.0 on Debian GNU/Linux 5.0.4 (lenny) I have in a VM. Instead of doing it correctly, it ends up looking like this, where the first cell of the row after the multirow is blacked-out garbage.
Try this:
\documentclass{article}
\usepackage{xcolor,colortbl}
\begin{document}
\begin{tabular}{|l|l|p{5cm}|p{2.5cm}|l|l|}
\hline
Stage & Aim & Procedure & Materials & Focus & Time \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Engage} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Study} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Activate} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\multicolumn{6}{|>{\columncolor[gray]{.8}}l|}{Conclusion} \\
\hline
Row 0 & Row 1 & Row 2 & Row 3 & Row 4 & Row 5 \\
\hline
\end{tabular}
\end{document}
Which produces:
EDIT:
Yes, >{...}
is the command to place your \columncolor
in (must be in it!). Also see 4.1 from this PDF.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With