I am attempting to automate alternating row colors in a longtable environment. My rows alternate between gray and white, and the alternating persists across pagebreaks. My issue is that I would like the first non-head row after a pagebreak to reset the alternating colors and always be gray again.
Here is a (very M)WE. xelatex is necessary for other things I am doing in case it breaks any solutions.
% !TeX program = xelatex
\documentclass{article}
\usepackage{longtable}
\usepackage[table]{xcolor}
\begin{document}
{\rowcolors{5}{white}{gray!25}
\begin{longtable}{ccc}
Talks.&&\\\endfirsthead
Talks, continued.&&\\\endhead
\multicolumn{3}{r}{Continued on next page.}\\\endfoot
\endlastfoot
Talk A&Place A&Date A\\
Talk B&Place B&Date B\\
Talk C&Place C&Date C\\
\newpage %Only a contrivance to see a pagebreak; in practice the pagebreak will be automatically determined.
Talk D&Place D&Date D\\
Talk E&Place E&Date E\\
Talk F&Place F&Date F\\
\end{longtable}}
\end{document}
I'd like rows D and F to be gray, and row E to be white; currently the opposite is true. I'd like to have this done automatically, so that as I add new rows and the pagebreak occurs in different locations, it automatically assigns the top non-head row to be gray and alternates from there.