我正在尝试显示表格的前半部分,然后单击并显示一些文本,然后单击并使文本消失并显示表格的后半部分。我已经让它暂停工作,但我希望发生的是表格始终固定在原位。添加文本后,它会跳来跳去,然后将其删除并添加表格的后半部分。我也遇到了同样的问题,即当文本移到下方并消失时,图形不会固定,但下面是我的表格示例代码:
\documentclass{beamer}
\mode<presentation>
{
\usetheme{Darmstadt} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\begin{document}
\begin{frame}{Empirical Observations}
\only<1-2>{
\begin{table}
\begin{center}
\caption{Correlation of health behaviors with LBW probability}
\label{tab:desc1}
\scriptsize
\begin{tabular}{l*{3}{c}}
\hline \noalign{\smallskip}
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)} \\
\hline \noalign{\smallskip}
Smoked entering t & 0.037*** & 0.013 & 0.011 \\
& (0.014) & (0.019) & (0.018) \\
Ever smoked & & 0.025 & 0.037** \\
& & (0.021) & (0.019) \\
Smoking cessation (years) & & -0.0064* & -0.0066** \\
& & (0.0034) & (0.0033) \\
\noalign{\smallskip} \hline \noalign{\smallskip}
\end{tabular}
\end{center}
\end{table}
}
\pause
\only<2>{
\skip
\small{
Compared to someone who smokes while pregnant:
\begin{itemize}
\item A woman who never smokes has a 4.8 pp lower probability of having a low birth weight birth
\item A woman who quit smoking three years before she got pregnant has a 2pp lower probability of having a low birth weight birth
\end{itemize}
}
}
\pause
\only<3>{
\begin{table}
\begin{center}
\caption{Correlation of health behaviors with LBW probability}
\label{tab:desc1}
\scriptsize
\begin{tabular}{l*{3}{c}}
\hline \noalign{\smallskip}
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)} \\
\hline \noalign{\smallskip}
Smoked entering t & 0.037*** & 0.013 & 0.011 \\
& (0.014) & (0.019) & (0.018) \\
Ever smoked & & 0.025 & 0.037** \\
& & (0.021) & (0.019) \\
Smoking cessation (years) & & -0.0064* & -0.0066** \\
& & (0.0034) & (0.0033) \\
\noalign{\smallskip} \hline \noalign{\smallskip}
Used marijuana entering t & 0.041** & 0.038 & 0.040* \\
& (0.018) & (0.024) & (0.024) \\
Ever used marijuana & & 0.0099 & 0.0076 \\
& & (0.020) & (0.019) \\
Marijuana cessation (years) & & 0.0015 & 0.0032 \\
& & (0.0029) & (0.0032) \\
\noalign{\smallskip}
\hline
Observable characteristics & N & N & Y \\
\noalign{\smallskip}
\hline
\end{tabular}
\end{center}
\end{table}
}
\end{frame}
\end{document}
答案1
使用t
作为可选参数\begin{frame}
应该会有所帮助。在下面的代码中,我还使用了booktabs
具有改进间距的水平线包:
\documentclass{beamer}
\mode<presentation>
{
\usetheme{Darmstadt} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\usepackage{booktabs}
\begin{document}
\begin{frame}[t]{Empirical Observations}
\only<1-2>{
\begin{table}
\centering
\caption{Correlation of health behaviors with LBW probability}
\label{tab:desc1}
\scriptsize
\begin{tabular}{p{3.5cm}*{3}{c}}
\toprule
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)} \\
\midrule
Smoked entering t & 0.037*** & 0.013 & 0.011 \\
& (0.014) & (0.019) & (0.018) \\
Ever smoked & & 0.025 & 0.037** \\
& & (0.021) & (0.019) \\
Smoking cessation (years) & & -0.0064* & -0.0066** \\
& & (0.0034) & (0.0033) \\
\midrule
\end{tabular}
\end{table}
}
\pause
\only<2>{
\smallskip
\small
Compared to someone who smokes while pregnant:
\begin{itemize}
\item A woman who never smokes has a 4.8 pp lower probability of having a low birth weight birth
\item A woman who quit smoking three years before she got pregnant has a 2pp lower probability of having a low birth weight birth
\end{itemize}
}
\pause
\only<3>{
\begin{table}
\centering
\caption{Correlation of health behaviors with LBW probability}
\label{tab:desc1}
\scriptsize
\begin{tabular}{p{3.5cm}*{3}{c}}
\toprule
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}&\multicolumn{1}{c}{(3)} \\
\midrule
Smoked entering t & 0.037*** & 0.013 & 0.011 \\
& (0.014) & (0.019) & (0.018) \\
Ever smoked & & 0.025 & 0.037** \\
& & (0.021) & (0.019) \\
Smoking cessation (years) & & -0.0064* & -0.0066** \\
& & (0.0034) & (0.0033) \\
\midrule
Used marijuana entering t & 0.041** & 0.038 & 0.040* \\
& (0.018) & (0.024) & (0.024) \\
Ever used marijuana & & 0.0099 & 0.0076 \\
& & (0.020) & (0.019) \\
Marijuana cessation (years) & & 0.0015 & 0.0032 \\
& & (0.0029) & (0.0032) \\
\midrule
Observable characteristics & N & N & Y \\
\bottomrule
\end{tabular}
\end{table}
}
\end{frame}
\end{document}