I am trying to create a table with alternating row colors using the xcolor
package with the [table]
option.
The following example demonstrates that the row coloring (uncommenting the \rowcolors..
) may hide/cover the table contents.
In particular there seems to be an issue with the @-expressions.
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\begin{document}
\begin{table}
\footnotesize
\centering
%\rowcolors{2}{gray!15}{white}
\begin{tabular}{lr@{\hspace{.1em}}c@{\hspace{.1em}}lcc}
&&&& Col 1 & Col 2 \\ \toprule
Row 1 & $(100$ & $\times$ & $100)$ & $1$ & $2$ \\
Row 2 & $(100$ & $\times$ & $1000)$& $3$ & $4$ \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
- How can we prevent that?
- A second question is whether there is an easy way to cover the entire line with color; one can observe the white padding in the gray line.
\documentclass{...}\usepackage{....}\begin{document}...\end{document}
. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. This makes it much easier for people to help you - and much more likely that they will!