# How to fill a table step by step automatically in beamer?

I have a table in beamer as follows:

    \begin{center}
A
\begin{tabular}{ | l | l | l |}
\hline
&  D & C \\ \hline
D & (-5, -5) & (0, -20) \\ \hline
C & (-20, 0) & (-1, -1)  \\ \hline
\end{tabular}
\end{center}


I would like to do this animation:

• step 1: Complete cell 1x1 when I click on mouse
• step 2: Complete cell 1x2 when I click on mouse
• step 3: complete cell 2x1 when I click on mouse and then complete cell 2x2

I did something like this:

   \begin{center}
A
\begin{tabular}{ | l | l | l |}
\hline
&  D & C \\ \hline
D & \onslide<2-4>{(-5, -5)} & \onslide<3-4>{(0, -20)} \\ \hline
C & \onslide<4>{(-20, 0)} & \onslide<4>{(-1, -1)}  \\ \hline
\end{tabular}
\end{center}


which does not work as I want because cell 2x1 and 2x2 will appear at the same time. If I change cell 2x2 to \onslide<5>{(-1, -1)}, it will appear after cell 2x1 but then I have to click on mouse.

Is there any way to correct this?

• It seems to me that it does what you want already. Am I misunderdtanding your question? – karlkoeller Feb 19 '15 at 6:19
• It does not work because I have something like this: First click on mouse, cell 1x1 appears. Second click on mouse, cell 1x2 appears. Thrid click on mouse, cell 2x1 and 2x2 appear at the same time. I want that in the third click on mouse cell 2x1 appears and then after few times (say 2 seconds) cell 2x2 appears (without clicking on mouse). So, how to fill the table cell by cell with only one click on mouse? – Jika Feb 19 '15 at 14:14

To me, you have instead 5 steps:

• step 0: Show empty table, then I click on mouse
• step 1: complete cell 1x1, then I click on mouse
• step 2: complete cell 1x2, then I click on mouse
• step 3: complete cell 2x1, then I click on mouse
• step 4: complete cell 2x2

So perhaps you miss something in the order:

   \begin{center}
A
\begin{tabular}{ | l | l | l |}
\hline
&  D & C \\ \hline
D & \onslide<2->{(-5, -5)} & \onslide<3->{(0, -20)} \\ \hline
C & \onslide<4->{(-20, 0)} & \onslide<5>{(-1, -1)}  \\ \hline
\end{tabular}
\end{center}


Note the use of the <2-> syntax to indicate that you show it from transition 2 to whenever the slide ends.