我想在我的演示文稿(beamer
)中包含一个表格,该表格有 2 个面板。我想先显示第一个面板,然后显示第二个面板,但不幸的是,我一直试图这样做,但没有成功。表格如下所示(我想先显示结果,$\alpha=0.05$
然后显示$\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}
答案1
在这种情况下,也许更简单的解决方案是使用\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}
或者简单的变化分别显示每个部分并最终显示整个表格:
\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}
产生不同类型的覆盖的另一种可能性是使用\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}