I am trying to put together a longtable in landscape mode over several pages using the longtable
package.
The idea is simple. I want alternating row colors in the main body of the table. However, the main body is divided into sections. I want the rows separating sections in a different color (gray). When I try to do this it messes up the rowcolor scheme.
Attached a self-contained example. I commented out the problematic rows separating sections of the main body of the table. Uncomment them to see problem. I tried some suggestions in this Q&A to no help.
\documentclass{article}
% Packages for tables
% --------------------
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage[table]{xcolor}
\definecolor{tableShade2}{HTML}{ECF3FE} % iTunes
% Blind text to fill space for typesetting
% ------------------------------------------
\usepackage[english]{babel}
\usepackage{blindtext}
% Set line spacing
% -----------------
\usepackage{setspace}
\doublespacing
\begin{document}
%Long landscape table
\begin{landscape}
\begin{center}
\begin{footnotesize}
\begin{singlespace}
\rowcolors{2}{tableShade2}{}
\begin{longtable}{p{3.4in}p{4.6in}} %p{} fixes width of some columns
\caption[Overview of hypothesis test procedures]{\emph{Overview of hypothesis
test procedures}} \label{tb:analysis}\\
%Define first header
\toprule
\hiderowcolors
\scshape Hypotheses & \scshape Test Procedure \\
\showrowcolors
\midrule
\endfirsthead
%Define second header
\multicolumn{2}{c}{{\bfseries \tablename\ \thetable{} -- continued from
previous page}}\\
\toprule
\hiderowcolors
\scshape Hypotheses & \scshape Test Procedure \\
\showrowcolors
\midrule
\endhead
%Define first footer
\bottomrule
\multicolumn{2}{r}{{Continued on next page}} \\
\endfoot
%Define last footer
\bottomrule
\endlastfoot
%First problematic row commented out
%\multicolumn{2}{>{\columncolor[gray]{0.8}}l}{Primary Objective: Lore Ipsum}\\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
%Second problematic row commented out
% \multicolumn{2}{>{\columncolor[gray]{0.8}}l}{Secondary Objective: Differences
% between x and y}\\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\multicolumn{2}{l}{\textbf{Awareness of pi}}\\
\blindtext
&
\blindtext. \\
\end{longtable}
\end{singlespace}
\end{footnotesize}
\end{center}
\end{landscape}
\end{document}