You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在LaTeX Beamer幻灯片中适配表格?

解决Beamer幻灯片中表格过宽的方法

针对表格无法适配Beamer幻灯片的问题,提供几种实用压缩方案:

1. 缩小整体字体

在表格代码外包裹字号命令,直接减小文本大小:

{
\footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{c}}
\hline\hline
                         &\multicolumn{1}{c}{(1)} \\
                         &\multicolumn{1}{c}{High blood pressure}\\
\hline
Body mass index (BMI)    &      0.0266\sym{***}\\
                         &     (18.01)         \\
30–39                    &      0.0771\sym{*}  \\
                         &      (2.31)         \\
40–49                    &      0.0994\sym{**} \\
                         &      (2.77)         \\
50–59                    &       0.286\sym{***}\\
                         &      (7.97)         \\
60–69                    &       0.282\sym{***}\\
                         &      (9.65)         \\
70+                      &       0.343\sym{***}\\
                         &      (7.94)         \\
Rural                    &     -0.0150         \\
                         &     (-1.00)         \\
Female                   &      -0.158\sym{***}\\
                         &     (-6.55)         \\
Diabetes status          &      0.0242         \\
                         &      (0.65)         \\
High lead level          &      0.0132         \\
                         &      (0.39)         \\
Black                    &      0.0802\sym{*}  \\
                         &      (2.10)         \\
Female $\times$ Black    &      0.0457         \\
                         &      (0.92)         \\
Female $\times$ 30–39    &   -0.000669         \\
                         &     (-0.02)         \\
Female $\times$ 40–49    &       0.117\sym{*}  \\
                         &      (2.51)         \\
Female $\times$ 50–59    &      0.0381         \\
                         &      (0.81)         \\
Female $\times$ 60–69    &       0.125\sym{***}\\
                         &      (3.34)         \\
Female $\times$ 70+      &       0.152\sym{**} \\
                         &      (2.74)         \\
\hline
Observations             &        4946         \\
\hline\hline
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
}

2. 用tabularx自动适配列宽

替换普通tabular为tabularx,让第一列自动拉伸压缩以适配幻灯片宽度(需在导言区引入tabularx包):

{
\footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabularx}{\linewidth}{Xc}
\hline\hline
                         &\multicolumn{1}{c}{(1)} \\
                         &\multicolumn{1}{c}{High blood pressure}\\
\hline
Body mass index (BMI)    &      0.0266\sym{***}\\
                         &     (18.01)         \\
% 剩余表格内容不变
\hline\hline
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabularx}
}

3. 减小列间距

在表格前添加命令缩小列之间的空白:

{
\setlength{\tabcolsep}{2pt}
\footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{c}}
% 表格内容不变
\end{tabular}
}

4. 简化变量名称

把长变量名精简,比如:

  • 将Body mass index (BMI)改为BMI
  • 将Female $\times$ 30–39改为Female×30–39(去掉冗余空格)

5. 拆分表格

若以上方法仍不满足,将表格按内容拆分到两张幻灯片,比如分为「基础变量」和「交互项」两个表格。

内容的提问来源于stack exchange,提问作者Eric

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 04:01:20