我正在使用该类beamer
进行演示,但我的回归表在垂直方向上不适合框架。我曾尝试使用\tiny
表格环境。即便如此,表格的一部分也不适合框架。
\begin{frame}{Results}
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{\tiny Effect of x on y}
\tiny
\begin{tabular}{l*{2}{c}}
\hline\hline
&\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
&\multicolumn{1}{c}{y1}&\multicolumn{1}{c}{y2}\\
\hline
1.x& 0.03** & 0.03* \\
& (0.157) & (0.62) \\
[1em]
1.hg& 0.16 & \\
& (0.84) & \\
[1em]
1.f#1.hg& -0.6* & \\
& (0.8) & \\
[1em]
1.i& 0.9 & -0.1 \\
& (0.30) & (0.36) \\
[1em]
1.i#1.hg& 0.167 & \\
& (0.200) & \\
[1em]
2.year & 0.63** & 0.03***\\
& (0.15) & (0.12) \\
[1em]
3.year & 0.07***& 0.17 \\
& (0.011) & (0.01) \\
[1em]
1.h & & 0.72** \\
& & (0.32) \\
[1em]
1.f#1.h & & -0.49* \\
& & (0.25) \\
[1em]
1.i#1.h & & -0.327 \\
& & (0.26) \\
[1em]
\_cons & 0.62***& -0.088 \\
& (0.54) & (0.59) \\
\hline
N & 500 & 455 \\
FE& Yes & Yes \\
Control & Yes & Yes \\
\hline\hline
\multicolumn{3}{l}{\tiny Standard errors in parentheses}\\
\multicolumn{3}{l}{\tiny * p<0.10, ** p<0.05, *** p<0.01}\\
\end{tabular}
\end{table}
\end{frame}
我也尝试过垂直调整大小,\resizebox{!}{\textwidth}
但没有效果。
有人能建议如何解决这个问题吗?谢谢
答案1
这个重新设计怎么样?
\documentclass{beamer}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\begin{frame}{Results}
\begin{table}[htbp]
\centering
\caption{Effect of x on y}
\footnotesize
\sisetup{table-format=-1.2, table-space-text-post={***}, table-align-text-post=false}
\begin{tabular}{l Sl Sl}
\toprule
& \multicolumn{2}{c}{(1) y1} & \multicolumn{2}{c}{(2) y2}\\
\cmidrule(r){2-3} \cmidrule(l){4-5}
1.x & 0.03** & (0.157) & 0.03* & (0.62) \\
1.hg & 0.16 & (0.84) & & \\
1.f\#1.hg & -0.6* & (0.8) & & \\
1.i & 0.9 & (0.30) & -0.1 & (0.36) \\
1.i\#1.hg & 0.167 & (0.200) & & \\
2.year & 0.63** & (0.15) & 0.03*** & (0.12) \\
3.year & 0.07*** & (0.011) & 0.17 & (0.01) \\
1.h & & & 0.72** & (0.32) \\
1.f\#1.h & & & -0.49* & (0.25) \\
1.i\#1.h & & & -0.327 & (0.26) \\
\_cons & 0.62*** & (0.54) & -0.088 & (0.59) \\
\cmidrule(r){2-3} \cmidrule(l){4-5}
N & \multicolumn{2}{c}{500} & \multicolumn{2}{c}{455} \\
FE & \multicolumn{2}{c}{Yes} & \multicolumn{2}{c}{Yes} \\
Control & \multicolumn{2}{c}{Yes} & \multicolumn{2}{c}{Yes} \\
\bottomrule
\multicolumn{5}{l}{\scriptsize Standard errors in parentheses}\\
\multicolumn{5}{l}{\scriptsize * p<0.10, ** p<0.05, *** p<0.01}\\
\end{tabular}
\end{table}
\end{frame}
\end{document}
答案2
还有一个可能的解决方案:源自不错的@leandriis 答案(+1),但对于练习使用tabularray
包:
\documentclass{beamer}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{frame}
\frametitle{Results}
\sisetup{table-format=-1.3{***},
table-align-text-post=false,
input-close-uncertainty=,
input-open-uncertainty=
}
\begin{table}
\vspace*{-\baselineskip}
\caption{Effect of x on y}
\vspace{-0.5\baselineskip}
\centering
\footnotesize
\SetTblrStyle{note}{font=\scriptsize, fg=gray3}
\begin{talltblr}[
label=none,
entry=none,
note{} = {Standard errors in parentheses:\newline
*: $p<0.10$,\quad
**: $p<0.05$,\quad
***: $p<0.01$.
}
]{colspec={l S S[table-format={(}1.3]
S S[table-format={(}1.2]},
row{3-Z} = {rowsep=0pt},
}
\toprule
& \SetCell[c=2]{c} {{{$y_1$}}}
& & \SetCell[c=2]{c} {{{$y_2$}}}
& \\
\cmidrule[r]{2-3} \cmidrule[l]{4-5}
& {{{(1)}}} & {{{(2)}}} & {{{(1)}}} & {{{(2)}}} \\
\midrule
1.x & 0.03** & (0.157) & 0.03* & (0.62) \\
1.hg & 0.16 & (0.84) & & \\
1.f\#1.hg & -0.6* & (0.8) & & \\
1.i & 0.9 & (0.30) & -0.1 & (0.36) \\
\addlinespace[3pt]
1.i\#1.hg & 0.167 & (0.200) & & \\
2.year & 0.63** & (0.15) & 0.03*** & (0.12) \\
3.year & 0.07*** & (0.011) & 0.17 & (0.01) \\
1.h & & & 0.72** & (0.32) \\
\addlinespace[3pt]
1.f\#1.h & & & -0.49* & (0.25) \\
1.i\#1.h & & & -0.327 & (0.26) \\
\_cons & 0.62*** & (0.54) & -0.088 & (0.59) \\
\cmidrule[r]{2-3} \cmidrule[l]{4-5}
N & \SetCell[c=2]{c} {{{500}}}
& & \SetCell[c=2]{c} {{{455}}}
& \\
FE & \SetCell[c=2]{c} {{{Yes}}}
& & \SetCell[c=2]{c} {{{Yes}}}
& \\
Control & \SetCell[c=2]{c} {{{Yes}}}
& & \SetCell[c=2]{c} {{{Yes}}}
& \\
\bottomrule
\end{talltblr}
\end{table}
\end{frame}
\end{document}
编辑:
表格上移了\baseline
。
答案3
为什么不水平打破表格:
\documentclass{beamer}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{document}
\begin{frame}{Results}
\begin{table}[htbp]
\centering
\caption{ Effect of x on y}
\scriptsize
\begin{tabular}{lcc|lcc}
\hline
&(1)&(2)&&(1)&(2)\\
&y1&y2&&y1&y2\\
\hline
1.x& 0.03** & 0.03* & 3.year & 0.07***& 0.17 \\
& (0.157) & (0.62) & & (0.011) & (0.01) \\
1.hg& 0.16 & &1.h & & 0.72** \\
& (0.84) & & & & (0.32) \\
1.f\#1.hg& -0.6* & &1.f\#1.h & & -0.49* \\
& (0.8) & & & & (0.25) \\
1.i& 0.9 & -0.1 & 1.i\#1.h & & -0.327 \\
& (0.30) & (0.36) & & & (0.26) \\
1.i\#1.hg& 0.167 & &\_cons & 0.62***& -0.088 \\
& (0.200) & & & (0.54) & (0.59) \\
2.year & 0.63** & 0.03*** &&&\\
& (0.15) & (0.12) &&& \\
\hline
N & 500 & \multicolumn{1}{c}{455} &&&\\
FE& Yes & \multicolumn{1}{c}{Yes} &&& \\
Control & Yes & \multicolumn{1}{c}{Yes} &&& \\
\hline
\multicolumn{6}{l}{\tiny Standard errors in parentheses}\\
\multicolumn{6}{l}{\tiny * p<0.10, ** p<0.05, *** p<0.01}\\
\end{tabular}
\end{table}
\end{frame}
\end{document}