How to create alternating rows in a table?
You can use the features of the colortbl package with additions of xcolor. See code below for a small example.
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[table]{xcolor} % loads also »colortbl«
\begin{document}
\rowcolors{2}{gray!25}{white}
\begin{tabular}{cc}
\rowcolor{gray!50}
Table head & Table head\\
Some values & Some values\\
Some values & Some values\\
Some values & Some values\\
Some values & Some values\\
\end{tabular}
\end{document}
The particular package manuals have the details.
This can easily be achieved using xcolor
. It is explained at Wikibooks, you just add the table
option to \usepackage{xcolor}
and in the table itself you put
\rowcolors{1}{color-1}{color-2}
One thing that might be worth pointing out, is that apparently, many packages call on xcolor
, and I had endless clashes first time I tried it, and it took me such a long time to figure this one out, so I felt it might help someone as slow as me to mention this: The xcolor package should be loaded last (or at least after the clashing packages).