Another desperate I-google-together-my-document person here: In my thesis I want to create light grey tables with darker grey top lines, but I encounter 2 problems:
If I use \rowcolor[RGB]{240,240,240} I get the result, but I can't figure out what I'm doing wrong when defining colors in the preamble. But that's the minor issue.
The big problem: I use a longtabu environment and can't get \rowcolors to work with it.
What I want it to look like (works):
\documentclass[11pt,a4paper, twoside]{scrbook}
\usepackage[english]{babel}
\usepackage{array}
\usepackage{longtable, tabu}
\usepackage[longtable,tabu]{xcolor}
\usepackage{colortbl}
\definecolor{grey1}{rgb}{240,240,240}
\definecolor{grey2}{rgb}{250,250,250}
\begin{document}
\begin{longtabu}[H]{XXl}
\caption[Chemicals and Reagents] {\textbf{Chemicals and Reagents}} \vspace{2mm}\\
\rowcolor[RGB]{240,240,240}
\textbf{Product} & \textbf{Manufacturer} & \textbf{Reference}\\
\rowcolor[RGB]{250,250,250}
Whatever & from whomever & 123456789\\
\rowcolor[RGB]{250,250,250}
Whatever & from whomever & 123456789\\
\rowcolor[RGB]{250,250,250}
Whatever & from whomever & 123456789\\
\end{longtabu}
\end{document}
The more elegant way I expected to work but doesn't:
\documentclass[11pt,a4paper, twoside]{scrbook}
\usepackage[english]{babel}
\usepackage{array}
\usepackage{longtable, tabu}
\usepackage[longtable,tabu]{xcolor}
\usepackage{colortbl}
\definecolor{grey1}{rgb}{240,240,240}
\definecolor{grey2}{rgb}{250,250,250}
\begin{document}
\rowcolors{1}{grey2}{grey2}
\begin{longtabu}[H]{XXl}
\caption[Chemicals and Reagents] {\textbf{Chemicals and Reagents}} \vspace{2mm}\\
\rowcolor{grey1}
\textbf{Product} & \textbf{Manufacturer} & \textbf{Reference}\\
Whatever & from whomever & 123456789\\
Whatever & from whomever & 123456789\\
Whatever & from whomever & 123456789\\
\end{longtabu}
\end{document}
Thank you already!


tableoption fromxcolorpackage loads thecolortblpackage, so there's no longer a need to load it separately. additionally, do you know iflongtableis a valid option forxcolor? – Troy May 13 '17 at 15:37xcolordocs to see if I'd missed anything, thanks for the catch!longtableis indeed not a valid option, correct, and the example still works without the separate loading ofcolortbl. Will update my code accordingly. – alpenwasser May 13 '17 at 15:42longtabu, more or less. But there is a small issue:\rowcolors{2}...still seems to color the caption; it doesn't seem to respect the starting value for where it is supposed to start coloring rows. But I understand your desire for those niceXcolumns; I'll see what can be done. – alpenwasser May 13 '17 at 15:44rowcolorsjust needs thetableoption to work. After perusing thetabudocumentation, I managed to fix the caption issue; it needs the\taburowcolorscommand. see edited example. Is that your desired result? – alpenwasser May 13 '17 at 15:57