I'm trying to insert some \noalign-code in every row of a tabular by using colortbl and \everycr or \CT@everycr. In most cases it works fine, but not if there is a \rowcolors-command (from xcolor) after my command: \rowcolors uses this code:
\CT@everycr{\@rowc@lors\the\everycr}
This doesn't expand \the\everycr and so whatever I put in \everycr is always ignored. Is this a bug or did I overlook something?
\documentclass{article}
\usepackage{array}
\usepackage[table]{xcolor}
\begin{document}
\makeatletter
\newcommand\test{\noalign{\hrule height 0.1cm width 5cm}}
\rowcolors{0}{green}{blue}
%Works after/without \rowcolors:
\CT@everycr\expandafter{\expandafter\test\the\CT@everycr}
\begin{tabular}[t]{ll}
foo & foo\\ foo & foo\\ \multicolumn{2}{l}{blub}
\end{tabular}
\bigskip
%this fails:
\everycr\expandafter{\expandafter\test\the\everycr}
\rowcolors{0}{red}{green}
%\CT@everycr{\@rowc@lors\the\everycr}%inserted by @rowcolors
%it would work if \rowc@lors would use this:
%\CT@everycr\expandafter{\expandafter\@rowc@lors\the\everycr}%
\makeatother
\begin{tabular}[t]{ll}
foo & foo\\ foo & foo\\ \multicolumn{2}{l}{blub}
\end{tabular}
\end{document}

\everycrget used, otherwise it would only use things that were in\everycrat the time of the definition. I'll need to look later to see what's going wrong here. – David Carlisle Jan 04 '13 at 16:36\everycrat the start. If I put\global\everycr{\test}at the start of the first row at least some of my lines reappears. – Ulrike Fischer Jan 04 '13 at 17:13\ialignto initialise tabular. Which means I suppose that formally LaTeX doesn't support use of \everycr :-) However it also means that the code in colortbl (and then xcolor) that carefully re-inserts \the\everycr isn't doing anything useful. Hmmmm – David Carlisle Jan 04 '13 at 17:25\CT@everycr\expandafter{\the\CT@everycr\@rowc@lors}instead (to reuse at least\CT@everycr): The content inserted bycolortbldisturbs the alternating colors. I will have to find some other way to preventrowcolorsto kill my code. – Ulrike Fischer Jan 05 '13 at 13:08bmwork withunicode-math:-) – David Carlisle Jan 05 '13 at 13:50