11

I want to include a table in my presentation (beamer) and this table has 2 panels. I want to first show the first panel and then the second panel, I have been trying to do it unfortunately without any luck. The table is like as shown below (I want to first show the results for $\alpha=0.05$ and then $\alpha=0.5$):

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    &\\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7\\

&\multicolumn{6}{c}{$\alpha$=0.5}\\

H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5  \\
\hline
\end{tabular}
\end{table}
\end{frame}
David Carlisle
  • 757,742
Thembi
  • 335

1 Answers1

22

Perhaps the simpler solution in this case is to use \only:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\only<1>{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\[-\normalbaselineskip]
}
\only<2>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here

Or a simple variation showing each part separately and finally the whole table:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\only<1,3>{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\[-\normalbaselineskip]
}\only<3>{\\}
\only<2,3>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here

Another possibility, producing a different kind of overlay, is to use \onslide:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{table}
\caption{Table}
\begin{tabular}{l c c c c c c}
\hline \hline
No.  & {Ordinary} & {Blue} & {Pink} & {Yellow} & {Green} & {RCM}\\
\hline
\onslide<1->{
&\multicolumn{6}{c}{$\alpha$=0.05}\\
H=2     &     95.0 &    75.3    &   75.7    &   79.5    &   72.0    &\\
H=3 & 95.6 &    87.0    &   87.3    &   87.6    &   85.2    & \\
H=4 & 95.0 &    91.6    &   91.9    &   90.3    &   90.2    & 93.3\\
H=5 & 95.2 &    93.5    &   93.7    &   91.3    &   91.8    & 94.3\\
H=6 & 94.9 &    93.8    &   94.1    &   92.6    &   92.8    & 94.7 \\
}
\onslide<2>{
&\multicolumn{6}{c}{$\alpha$=0.5}\\
H=2 & 95.0  &   91.4    &   91.2    &   79.5    &   99.9    &   \\
H=3 & 95.6  &   95.1    &   95.1    &   87.6    &   95.1    &   \\
H=4 & 95.0  &   94.8    &   94.8    &   90.3    &   93.5    & 95.5  \\
H=5 & 95.2  &   95.1    &   95.2    &   91.3    &   93.1    & 95.9  \\
H=6 & 94.9  &   94.8    &   94.8    &   92.6    &   93.4    & 95.5 \\[-\normalbaselineskip]
}
\\\hline
\end{tabular}
\end{table}
\end{frame}

\end{document}

enter image description here

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
  • Oh fancy! Animated gifs! Amazing how simple technology catches on quickly. (nice answer, too, by the way) – Andrew Stacey Nov 22 '12 at 07:20
  • Perfect Gonzalo, the last possibility is exactly what I was looking for, Great animation by the way! – Thembi Nov 22 '12 at 11:21
  • @Gonzalo Medina: I am wondering does the last option work on the beamer as well ? I tried that it is showing on two pages but on both the pages it is showing all the rows of the table. – Jdbaba Jun 17 '13 at 20:37
  • @Jdbaba I don't understand your question. I am using beamer on all the code of my answer. – Gonzalo Medina Jun 17 '13 at 20:40
  • @GonzaloMedina I used the part of your code from \begin{frame} to \end{frame} but I am not able to get pause or onslide effect. If I use all the code then I am able to see the effect but if I only copy the section then I am not able to see the effect. Any suggestions please ? BTW is it possible to overlay tables over image ? – Jdbaba Jun 17 '13 at 20:42
  • @Jdbaba as my images show, the effect works in my example code, so something else must be going on in your document. Please feel free to open a fresh new question adding a complete minimal document illustrating the problem. – Gonzalo Medina Jun 17 '13 at 20:44
  • Unfortunately, the last example (using \onslide) does not work in combination with \setbeamercovered{dynamic}, at least for me. Maybe this was also your problem, @Jdbaba? – hplieninger Mar 21 '14 at 07:17
  • NOTE: when doing this, LaTeX seems to have problems with \hline as the first element of of the \onslide/\visible/\only/whatever beamer environment you use to progressively display the table. Putting it outside the environment or later inside the environment seems to work just fine. – Jonathan Geisler Feb 09 '17 at 18:27