# Auto overlay table rows with \rowfont (tabu) and beamer

I have a table in a presentation which I would like to color the text of each row as it is revealed. I'm currently using the beamer package and a variation of a related solution which requires specifying the slide number for each row.

Here is a MWE illustrating my current "manual" method which has the desired end result.

\documentclass{beamer}

\usepackage{tabu}

\newcommand{\rowcolor}[1]{\rowfont{\leavevmode\temporal<#1>{\color{white}}{\color{blue}}{\color{normal text.fg}}}}

\begin{document}

\begin{frame}{A Table}
\begin{tabu}{lll}
\rowcolor{1} cell 1 & cell 2 & cell 3\\
\rowcolor{2} cell 4 & cell 5 & cell 6\\
\rowcolor{3} cell 7 & cell 8 & cell 9
\end{tabu}

\end{frame}

\end{document}

I attempted to use enclose my \rowcolor function inside an \everyrow function

...
\everyrow{\rowcolor{+}}
\begin{tabu}{lll}
...

However, apparently \rowfont inserts its argument into each cell of the row before the contents are evaluated by beamer, so that the <+> specification will then get incremented for each cell, not just for each row.

Is there a way to increment the slide number before \rowfont is executed?Or is there a better way to auto increment the slides without specifying slide number explicitly for each row?

Something like this might do the trick (needs >= 2 compilations for the correct result):

\documentclass{beamer}

\usepackage{tabu}

\usepackage{totcount}
\newtotcounter{totalrows}

\begin{document}

\begin{frame}
\frametitle{A Table}

bla\pause

test\pause

\everyrow{%
\ifnum\thetaburow<\totvalue{totalrows}
\only<+>{\rowfont{\leavevmode\color{blue}}}
\fi
}

\begin{tabu}{lll}
cell 1 & cell 2 & cell 3\\
cell 4 & cell 5 & cell 6\\
cell 7 & cell 8 & cell 9
\setcounter{totalrows}{\thetaburow}
\end{tabu}

\end{frame}

\end{document}

• This is definitely a move in the right direction. I don't know why the extra slide is created either. FYI, your solution will also work with \temporal. Now if I could just figure out the extra slide problem...In that vein, I've also tried replacing the <+> overlay marker with <\thetaburow>, which gets rid of the extra slide, but offsets the overlay number, i.e. \thetaburow expands to 0 on the first implementation of the overlay specification. – mrclary Aug 10 '16 at 4:09
• If I could get something like <{\thetaburow+1}>, it would work perfectly. – mrclary Aug 10 '16 at 4:20
• @mrclary See the edit. A bit hacky, but it seems to work. – samcarter_is_at_topanswers.xyz Aug 10 '16 at 9:33
• It's hacky, but it works! – mrclary Aug 10 '16 at 16:22