4

In Why can't I wrap \rowcolor in \only? (Beamer), there are solutions to how to use \rowcolor with \only in Beamer. Is there a way to use \columncolor in a similar way?

0
4

The \columncolor macro seems to be very special handled1 and can't be patched to support beamer overlays. I would do it be using custom column types which are defined differently depending on the overlay:

\documentclass[table]{beamer}

\begin{document}

\begin{frame}<1-3>

\alt<2>
{\newcolumntype{a}{>{\columncolor{blue}}c}}
{\newcolumntype{a}{>{\columncolor{yellow}}c}}

\temporal<2>
{\newcolumntype{b}{c}}
{\newcolumntype{b}{>{\columncolor{green}}c}}
{\newcolumntype{b}{>{\columncolor{red}}c}}

\begin{tabular}{ab}
   A &  B \\
   A &  B \\
   A &  B \\
\end{tabular}

\end{frame}

\end{document}

1 In fact \columncolor is never defined at all! Another internal tabular macro simply scans the tabular preamble for it and extracts the argument of it!

2
  • Works perfectly! Although I do not fully understand the syntax...:)
    – Li Wang
    Jul 21 '11 at 10:01
  • @Lee: See the array package manual. >{code} adds the code before (>) every cell. There is also <{code} which adds it afterwards and must be used after the column character. Jul 21 '11 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.