# Altering only header \hline colors with longtabu and colortbl

I'm trying to make a table with the following properties:

1. If the table is very long, the header should be repeated on each new page.
2. Each row should be separated by a line.
3. The line immediately after the header row should be black, whereas all the other lines should be gray.

To achieve this, I'm using the longtabu environment, together with colortbl to change the color of the lines between the rows. According to the colortbl documentation, \arrayrulecolor{} will change the color of any lines after the statement. As such, I figured the following would work as expected:

\documentclass[letterpaper,10pt]{report}

\usepackage[margin=1in]{geometry}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{colortbl}

\definecolor{light-gray}{gray}{0.8}

\begin{document}

\begin{longtabu}{ l l }
\arrayrulecolor{black} % Make the header line black.
Column 1 & Column 2 \\
\hline
\arrayrulecolor{light-gray} % Any other lines that come after the header are gray.
Foo & Bar \\
\hline
Foo & Bar \\
\hline
% ... More lines ...
Foo & Bar \\
\hline
Foo & Bar
\end{longtabu}

\end{document}


However, despite the fact that the header is properly repeated, the \arrayrulecolor{black} line isn't - i.e., only the very first header line is black, while the rest are light-gray.

I tried Googling, but I can't seem to find a good example of how to do this. How can I achieve the table style I'm looking for?

First of all, there is no need to load colortbl, since you can replace \arrayrulecolor with the command \taburulecolor provided by tabu.

Having said that, it works if you replace all \hlines with \tabucline{1-}.

Remember that you can issue the command

\everyrow{\tabucline{1-}}


if you want every row followed by an horizontal line.

MWE (I've substituted black with red just for displaying purposes):

\documentclass[letterpaper,10pt]{report}

\usepackage[margin=1in]{geometry}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{xcolor}

\definecolor{light-gray}{gray}{0.8}

\begin{document}

\begin{longtabu}{ l l }
\taburulecolor{red} % Make the header line black.
Column 1 & Column 2 \\
\tabucline{1-}
\taburulecolor{light-gray} % Any other lines that come after the header are gray.
\everyrow{\tabucline{1-}}
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\
Foo & Bar \\

\end{longtabu}

\end{document}


Output (second page):

• This works decently well, but if I switch to \tabucline then I lose the page-breaking functionality of \hline (see tex.stackexchange.com/questions/118988/…). I may end up doing this, but I'll leave this questions open for a little while to see if anyone has a solution that uses \hline. – CmdrMoozy Feb 3 '14 at 17:11