Beamer – ```\onslide`` 不起作用

Beamer – ```\onslide`` 不起作用
            \begin{tabular}[t]{lcccc}
                \toprule
                \multicolumn{1}{c}{ } & \multicolumn{4}{c}{(ATT)}\\
                \cmidrule(l{3pt}r{3pt}){2-5} 
                \multicolumn{1}{c}{ } & \multicolumn{2}{c}{(C/S)} & \multicolumn{2}{c}{(TWFE)} \\
                \cmidrule(l{3pt}r{3pt}){2-3} \cmidrule(l{3pt}r{3pt}){4-5}  
                & (1) & (2) & (3) & (4)\\

                \midrule
                %
                \onslide<1->{
                \multicolumn{2}{l}{\textit{Panel A: Main}} &&& \\
                
                & 0.0013 & 0.0014 & 0.0018 & 0.0021\\
                & [$-$0.0602, 0.0628] & [$-$0.0549, 0.0577] & [$-$0.0237, 0.0274] &  [$-$0.0188, 0.0231]\\
                WCB p-val. & - & - & 0.8859 & 0.9209\\
                %
                \midrule
                }
                \multicolumn{2}{l}{\textit{Panel B: Treatment assignment in grade 4}} &&& \\
                & $-$0.0268 & $-$0.0184 & $-$0.0224 & $-$0.0189\\
                & [$-$0.0619, 0.0084] & [$-$0.0543, 0.0175] & [$-$0.0308, $-$0.0139] & [$-$0.0290, $-$0.0088]\\
                WCB p-val. & - & - & 0.2923 & 0.3183\\
                %
                \midrule
                %
                \multicolumn{2}{l}{\textit{Panel C: Stricter definition of success}} &&&\\
                & $-$0.0211 & $-$0.0159 & $-$0.0410 & $-$0.0406\\
                & [$-$0.0859, 0.0437] & [$-$0.0737, 0.0419] & [$-$0.0490, $-$0.0330] & [$-$0.0549, $-$0.0263]\\
                WCB p-val. & - & - & 0.0460 & 0.1301\\
                %
                \midrule
                N  & 22,895 & 22,895 & 22,895 & 22,895\\
                \bottomrule
            \end{tabular}

\onslide我想随后显示面板,但在 beamer 环境中使用和命令无法实现\only。它们导致出现多个错误消息,如下所示Misplaced \omit. \end{frame}Missing \cr inserted. \end{frame}

答案1

你可以\pause这样使用:

\documentclass[10pt]{beamer}
\usepackage{booktabs}
\usepackage{multicol}

\begin{document}
    \begin{frame}
\resizebox{\textwidth}{!}{
    \begin{tabular}[t]{lcccc}
        \toprule
        \multicolumn{1}{c}{ } & \multicolumn{4}{c}{(ATT)}\\
        \cmidrule(l{3pt}r{3pt}){2-5} 
        \multicolumn{1}{c}{ } & \multicolumn{2}{c}{(C/S)} & \multicolumn{2}{c}{(TWFE)} \\
        \cmidrule(l{3pt}r{3pt}){2-3} \cmidrule(l{3pt}r{3pt}){4-5}  
        & (1) & (2) & (3) & (4)\\
        \midrule
        \multicolumn{2}{l}{\textit{Panel A: Main}} &&& \\
        & 0.0013 & 0.0014 & 0.0018 & 0.0021\\
        & [$-$0.0602, 0.0628] & [$-$0.0549, 0.0577] & [$-$0.0237, 0.0274] &  [$-$0.0188, 0.0231]\\
        WCB p-val. & - & - & 0.8859 & 0.9209 \pause\\ 
        \midrule 
        \multicolumn{2}{l}{\textit{Panel B: Treatment assignment in grade 4}} &&& \\
        & $-$0.0268 & $-$0.0184 & $-$0.0224 & $-$0.0189\\
        & [$-$0.0619, 0.0084] & [$-$0.0543, 0.0175] & [$-$0.0308, $-$0.0139] & [$-$0.0290, $-$0.0088]\\
        WCB p-val. & - & - & 0.2923 & 0.3183 \pause\\
        \midrule 
        \multicolumn{2}{l}{\textit{Panel C: Stricter definition of success}} &&&\\
        & $-$0.0211 & $-$0.0159 & $-$0.0410 & $-$0.0406\\
        & [$-$0.0859, 0.0437] & [$-$0.0737, 0.0419] & [$-$0.0490, $-$0.0330] & [$-$0.0549, $-$0.0263]\\
        WCB p-val. & - & - & 0.0460 & 0.1301\\
        \midrule
        N  & 22,895 & 22,895 & 22,895 & 22,895\\
        \bottomrule
        \end{tabular}}
    \end{frame}

如需详细信息,请参阅Beamer 用户指南. 特别是第 23.5 节。

相关内容