Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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!

share|improve this answer
    
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. –  Martin Scharrer Jul 21 '11 at 10:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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