I've got many tables throughout my document that I would like to be colored like this, with the first row in a dark grey, then the even rows in white and the odd rows in a light grey:
Currently I'm using this to achieve this:
\usepackage[table]{xcolor}
\rowcolors{2}{white}{gray!15}
\begin{tabularx}{cX}
\rowcolor{gray!50}
Row Number & Text \\
\hline
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\end{tabularx}
I'm looking for a way to avoid having to call \rowcolors
and \hline
with every tabularx begin. Is there a way to do this while keeping a variable number of columns?
An interface of something like this would be ideal:
\begin{something}{cc}
Row Number & Text \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\therownum & test \\
\end{something}
tabularray
provides extra functionality to define the default design of tables. BTW: Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.