# Adding color to a table column as a beamer overlay

I'm trying to have an overlay that adds a background color to a column of a table in beamer.

I can create a table with a colored second column using the colortbl package.

\begin{tabular}[]{r >{\columncolor{red!30}}} c}
...
\end{tabular}


If I try to simply make the color code an overlay this doesn't work (as I expected).

\begin{tabular}[]{r \onslide[2-]{>{\columncolor{red!30}}} c}


Can I create the effect I intend (without simply duplicating the table)?

-
On a side note and just in case someone might have the same question as I had (Google brought me here): I tried to do the same thing with \cellcolor and used \visible<2-> but that didn't work – the cell still had the same color in every frame. The solution: Use \only instead of \visible. –  balu Jul 7 '13 at 18:41

Try conditionally defining a column type and using that:

\documentclass{beamer}
\usepackage{colortbl}
\begin{document}

\begin{frame}
\newcolumntype{C}{c}
\only<2->{\newcolumntype{C}{>{\columncolor{red!30}}c}}
\begin{tabular}[]{rC}
1 & 2 \\
3 & 4 \\
\end{tabular}
\end{frame}
\end{document}


You get a package warning for redefining the column type but there's no \renewcolumntype so you have to live with it.

-
Great! I didn't expect it to be possible at all. :) –  ziggystar Nov 30 '10 at 15:47