# How to uncover a table column wise in Latex beamer

I have a table with 7 columns and want to show the first 5 at once, and then the 6th and 7th on consecutive slides.

This is the code I have for now:

\begin{frame}{Наслов}
\begin{itemize}
\item Ставка.
\end{itemize}
\begin{tabular}{ccccc<{\onslide<2->}c<{\onslide}c}
$p_1$ & $p_2$ & $\ldots$ & $p_{9}$ & $p_{10}$ & $W$  & $D$\\
$1$   & $1$   & $\ldots$ & $1$      & $1$     & $w_1$& $d_1$\\
$1$   & $1$   & $\ldots$ & $1$      & $0$     & $w_2$& $d_2$\\
$1$   & $1$   & $\ldots$ & $0$      & $1$     & $w_3$& $d_3$\\
$1$   & $1$   & $\ldots$ & $0$      & $0$     & $w_4$& $d_4$\\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$\\
$0$   & $0$   & $\ldots$ & $0$      & $1$     & $w_{1023}$& $d_{1023}$\\
$1$   & $1$   & $\ldots$ & $0$      & $0$     & $w_{1024}$& $d_{1024}$
\end{tabular}
\end{frame}


This produces 2 slides: the first one with p1, p2, ..., p9, p10 and D columns, and the second with W added, while I want them to appear in the following order:

• 1st slide: p1, p2, ..., p9, p10
• 2nd slide: p1, p2, ..., p9, p10, W
• 3rd slide: p1, p2, ..., p9, p10, W, D

I looked in the manual and found this example:

\begin{frame}
\begin{tabular}{l!{\vrule}c<{\onslide<2->}c<{\onslide<3->}c<{\onslide<4->}c<{\onslide}c}
Class & A & B & C & D \\
217
X & 1 & 2 & 3 & 4 \\
Y & 3 & 4 & 5 & 6 \\
Z & 5 & 6 & 7 & 8
\end{tabular}
\end{frame}


which does what is supposed to. However, I don't seem to be able to apply its logic to my problem. :( Is anyone willing to help?

P.S. What are the meanings of < and ! in columns specification?

The following seems to do what you're asking for, after adding array to the preamble:

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

\begin{frame}
\begin{tabular}{ccccc<{\onslide<2->}c<{\onslide<3->}c<{\onslide}}
$p_1$ & $p_2$ & $\ldots$ & $p_{9}$ & $p_{10}$ & $W$  & $D$\\
$1$   & $1$   & $\ldots$ & $1$      & $1$     & $w_1$& $d_1$\\
$1$   & $1$   & $\ldots$ & $1$      & $0$     & $w_2$& $d_2$\\
$1$   & $1$   & $\ldots$ & $0$      & $1$     & $w_3$& $d_3$\\
$1$   & $1$   & $\ldots$ & $0$      & $0$     & $w_4$& $d_4$\\
$\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\vdots$\\
$0$   & $0$   & $\ldots$ & $0$      & $1$     & $w_{1023}$& $d_{1023}$\\
$1$   & $1$   & $\ldots$ & $0$      & $0$     & $w_{1024}$& $d_{1024}$
\end{tabular}
\end{frame}

\end{document}

• It seems that setting \setbeamercovered{dynamic} prevents this from working. Putting \setbeamercovered{invisible} inside the frame fixes the issue. – Miguel Dec 12 '16 at 16:54
• It worked here even without the collcell package. This doesn't work with \hline, does it? – Waldir Leoncio May 17 '17 at 8:09
• @WaldirLeoncio: You need at least the array package which supports the >{..} and <{..} notation. collcell loads array. You might be interested in Easiest way to delete a column? – Werner May 17 '17 at 18:48
• I am trying to do this with the separation bars in between columns and it is giving me an error -- i.e., if I change the tabular definition to \begin{tabular}{c|c|c|c|c|<{\onslide<2->}c|<{\onslide<3->}c<{\onslide}|}. Any way to fix that? – ozsu Jan 3 '18 at 16:21
• @ozsu: See this paste. You can only insert content immediately before or after the column, not the vertical rules. If you want to have an \onslide rule, then you have to insert it using \vrule. – Werner Jan 3 '18 at 17:10