输出为 PDF 时,Latex 中的大 table 会被截断吗?

Large table in Latex gets cut off when outputting to PDF?

我没有使用过太多 Latex 语法,所以我不太确定我需要在此处进行哪些样式更改。

我有一大块 Latex:

\documentclass{article}
\usepackage{longtable}
\begin{document}
\begin{center}
\begin{longtable}{|l|l|l|} \centering

\begin{tabular}{@{\extracolsep{5pt}}lcccccccc}
\[-1.8ex]\hline
\hline \[-1.8ex]
 & \multicolumn{8}{c}{\textit{Dependent variable:}} \
\cline{2-9}
\[-1.8ex] & \multicolumn{2}{c}{Female} & \multicolumn{4}{c}{NonWhite} & \multicolumn{2}{c}{Black.or.African.American} \
\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8)\
\hline \[-1.8ex]
 factor(ELECTORAL\_TERM)2018 & 0.104$^{***}$ & 0.104$^{***}$ & $-[=11=].104$^{***}$ & $-[=11=].104$^{***}$ & $-[=11=].103$^{***}$ & $-[=11=].103$^{***}$ & $-[=11=].047$^{***}$ & $-[=11=].047$^{***}$ \
  & (0.010) & (0.010) & (0.009) & (0.009) & (0.009) & (0.009) & (0.006) & (0.006) \
  & & & & & & & & \
 factor(ELECTORAL\_TERM)2019 & 0.129$^{***}$ & 0.128$^{***}$ & 0.088$^{***}$ & 0.088$^{***}$ & 0.092$^{***}$ & 0.092$^{***}$ & 0.063$^{***}$ & 0.063$^{***}$ \
  & (0.011) & (0.011) & (0.009) & (0.010) & (0.009) & (0.009) & (0.007) & (0.007) \
  & & & & & & & & \
 WOMENS\_RIGHTS\_PROTEST & $-[=11=].016 & $-[=11=].025 &  &  &  &  &  &  \
  & (0.018) & (0.019) &  &  &  &  &  &  \
  & & & & & & & & \
 WOMENS\_RIGHTS\_COUNTERPROTEST &  & 0.052 &  &  &  &  &  &  \
  &  & (0.043) &  &  &  &  &  &  \
  & & & & & & & & \
 RACIAL\_PROTEST &  &  & 0.032$^{***}$ & 0.032$^{***}$ &  &  & 0.020$^{***}$ & 0.021$^{***}$ \
  &  &  & (0.010) & (0.011) &  &  & (0.007) & (0.008) \
  & & & & & & & & \
 RACIAL\_COUNTERPROTEST &  &  &  & 0.001 &  &  &  & $-[=11=].007 \
  &  &  &  & (0.039) &  &  &  & (0.028) \
  & & & & & & & & \
 OTHER\_IDENTITY\_PROTEST &  &  &  &  & 0.057 & 0.068 &  &  \
  &  &  &  &  & (0.077) & (0.078) &  &  \
  & & & & & & & & \
 OTHER\_IDENTITY\_COUNTERPROTEST &  &  &  &  &  & $-[=11=].116 &  &  \
  &  &  &  &  &  & (0.156) &  &  \
  & & & & & & & & \
 Republican.Party & 0.061$^{***}$ & 0.061$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.027$^{***}$ & 0.027$^{***}$ \
  & (0.014) & (0.014) & (0.012) & (0.012) & (0.012) & (0.012) & (0.009) & (0.009) \
  & & & & & & & & \
 Democratic.Party & 0.386$^{***}$ & 0.386$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.083$^{***}$ & 0.083$^{***}$ \
  & (0.016) & (0.016) & (0.014) & (0.014) & (0.014) & (0.014) & (0.010) & (0.010) \
  & & & & & & & & \
 CIT\_EST\_White & $-[=11=].002 & $-[=11=].002 & 0.001 & 0.001 & 0.001 & 0.001 & 0.0002 & 0.0002 \
  & (0.002) & (0.002) & (0.001) & (0.001) & (0.001) & (0.001) & (0.001) & (0.001) \
  & & & & & & & & \
 CIT\_EST\_African\_American & 0.007$^{**}$ & 0.007$^{**}$ & 0.001 & 0.001 & 0.001 & 0.001 & 0.0005 & 0.0005 \
  & (0.004) & (0.004) & (0.003) & (0.003) & (0.003) & (0.003) & (0.002) & (0.002) \
  & & & & & & & & \
 CIT\_EST\_NonWhite & 0.014 & 0.014 & $-[=11=].004 & $-[=11=].004 & $-[=11=].004 & $-[=11=].004 & $-[=11=].002 & $-[=11=].002 \
  & (0.011) & (0.011) & (0.009) & (0.009) & (0.009) & (0.009) & (0.007) & (0.007) \
  & & & & & & & & \
 CVAP\_EST\_White & 0.007 & 0.007 & $-[=11=].002 & $-[=11=].002 & $-[=11=].002 & $-[=11=].002 & $-[=11=].001 & $-[=11=].001 \
  & (0.004) & (0.004) & (0.004) & (0.004) & (0.004) & (0.004) & (0.003) & (0.003) \
  & & & & & & & & \
 CVAP\_EST\_African\_American & $-[=11=].007 & $-[=11=].007 & $-[=11=].002 & $-[=11=].002 & $-[=11=].002 & $-[=11=].002 & $-[=11=].001 & $-[=11=].001 \
  & (0.006) & (0.006) & (0.005) & (0.005) & (0.005) & (0.005) & (0.004) & (0.004) \
  & & & & & & & & \
 CVAP\_EST\_NonWhite & $-[=11=].020 & $-[=11=].020 & 0.006 & 0.006 & 0.006 & 0.006 & 0.002 & 0.002 \
  & (0.016) & (0.016) & (0.014) & (0.014) & (0.014) & (0.014) & (0.010) & (0.010) \
  & & & & & & & & \
 Constant & $-.099 & $-.099 & 5.245 & 5.245 & 5.244 & 5.241 & 1.899 & 1.898 \
  & (14.561) & (14.561) & (12.598) & (12.599) & (12.608) & (12.609) & (8.972) & (8.972) \
  & & & & & & & & \
\hline \[-1.8ex]
Observations & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 \
R$^{2}$ & 0.778 & 0.778 & 0.660 & 0.660 & 0.659 & 0.659 & 0.664 & 0.664 \
Adjusted R$^{2}$ & 0.654 & 0.654 & 0.468 & 0.468 & 0.468 & 0.468 & 0.476 & 0.476 \
Residual Std. Error & 0.403 (df = 6145) & 0.403 (df = 6144) & 0.348 (df = 6145) & 0.348 (df = 6144) & 0.349 (df = 6145) & 0.349 (df = 6144) & 0.248 (df = 6145) & 0.248 (df = 6144) \
F Statistic & 6.250$^{***}$ (df = 3448; 6145) & 6.249$^{***}$ (df = 3449; 6144) & 3.452$^{***}$ (df = 3448; 6145) & 3.450$^{***}$ (df = 3449; 6144) & 3.443$^{***}$ (df = 3448; 6145) & 3.442$^{***}$ (df = 3449; 6144) & 3.524$^{***}$ (df = 3448; 6145) & 3.523$^{***}$ (df = 3449; 6144) \
\hline
\hline \[-1.8ex]
\textit{Note:}  & \multicolumn{8}{r}{$^{*}$p$<[=11=].1; $^{**}$p$<[=11=].05; $^{***}$p$<[=11=].01} \
\end{tabular}
\end{longtable} 
\end{center}
\end{document}

然而,输出的 PDF 看起来像这样:

table 的底部和右侧都被切掉了。如您所见,我尝试使用 longtable,但这似乎没什么用。我不确定我是否需要旋转 table,或者将 table 右移,或者允许额外的页面,或者什么。

几个想法:

  • 不要在 longtable 中使用 tabular。 Longtable 是为了代替而不是在 tabular

    周围使用
  • 如果您的 table 已经太大而无法容纳页面,请不要通过手动添加 extracolsep

    使其更大
  • 横向使用纸张获得更多space

  • 减少边距

  • 使用固定宽度的列强制换行以使列变小

  • 第一列中的变量名称很长,latex 无法自动将它们连字。定义可能的断点

  • df 值放在新行中以使列变小

  • 如果这一切都没有帮助,请使用更大的纸张或将 table 分成多个 table 并减少列数


\documentclass{article}
\usepackage{longtable}

\usepackage[landscape,hmargin=0.5cm]{geometry}
\begin{document}
\begin{longtable}{p{4.6cm}*{8}{p{1.7cm}}}
\[-1.8ex]\hline
\hline \[-1.8ex]
 & \multicolumn{8}{c}{\textit{Dependent variable:}} \
\cline{2-9}
\[-1.8ex] & \multicolumn{2}{c}{Female} & \multicolumn{4}{c}{NonWhite} & \multicolumn{2}{c}{Black.or.Afr.Am.} \
\[-1.8ex] & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8)\
\hline \[-1.8ex]
 factor(\-ELECTORAL\-\_TERM)2018 & 0.104$^{***}$ & 0.104$^{***}$ & $-[=10=].104$^{***}$ & $-[=10=].104$^{***}$ & $-[=10=].103$^{***}$ & $-[=10=].103$^{***}$ & $-[=10=].047$^{***}$ & $-[=10=].047$^{***}$ \
  & (0.010) & (0.010) & (0.009) & (0.009) & (0.009) & (0.009) & (0.006) & (0.006) \
  & & & & & & & & \
 factor(\-ELECTORAL\-\_TERM)2019 & 0.129$^{***}$ & 0.128$^{***}$ & 0.088$^{***}$ & 0.088$^{***}$ & 0.092$^{***}$ & 0.092$^{***}$ & 0.063$^{***}$ & 0.063$^{***}$ \
  & (0.011) & (0.011) & (0.009) & (0.010) & (0.009) & (0.009) & (0.007) & (0.007) \
  & & & & & & & & \
 WOMENS\-\_RIGHTS\-\_PROTEST & $-[=10=].016 & $-[=10=].025 &  &  &  &  &  &  \
  & (0.018) & (0.019) &  &  &  &  &  &  \
  & & & & & & & & \
 WOMENS\-\_RIGHTS\-\_COUNTERPROTEST &  & 0.052 &  &  &  &  &  &  \
  &  & (0.043) &  &  &  &  &  &  \
  & & & & & & & & \
 RACIAL\-\_PROTEST &  &  & 0.032$^{***}$ & 0.032$^{***}$ &  &  & 0.020$^{***}$ & 0.021$^{***}$ \
  &  &  & (0.010) & (0.011) &  &  & (0.007) & (0.008) \
  & & & & & & & & \
 RACIAL\-\_COUNTERPROTEST &  &  &  & 0.001 &  &  &  & $-[=10=].007 \
  &  &  &  & (0.039) &  &  &  & (0.028) \
  & & & & & & & & \
 OTHER\-\_IDENTITY\-\_PROTEST &  &  &  &  & 0.057 & 0.068 &  &  \
  &  &  &  &  & (0.077) & (0.078) &  &  \
  & & & & & & & & \
 OTHER\-\_IDENTITY\-\_COUNTERPROTEST &  &  &  &  &  & $-[=10=].116 &  &  \
  &  &  &  &  &  & (0.156) &  &  \
  & & & & & & & & \
 Republican.Party & 0.061$^{***}$ & 0.061$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.068$^{***}$ & 0.027$^{***}$ & 0.027$^{***}$ \
  & (0.014) & (0.014) & (0.012) & (0.012) & (0.012) & (0.012) & (0.009) & (0.009) \
  & & & & & & & & \
 Democratic.Party & 0.386$^{***}$ & 0.386$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.162$^{***}$ & 0.083$^{***}$ & 0.083$^{***}$ \
  & (0.016) & (0.016) & (0.014) & (0.014) & (0.014) & (0.014) & (0.010) & (0.010) \
  & & & & & & & & \
 CIT\-\_EST\-\_White & $-[=10=].002 & $-[=10=].002 & 0.001 & 0.001 & 0.001 & 0.001 & 0.0002 & 0.0002 \
  & (0.002) & (0.002) & (0.001) & (0.001) & (0.001) & (0.001) & (0.001) & (0.001) \
  & & & & & & & & \
 CIT\-\_EST\-\_African\-\_American & 0.007$^{**}$ & 0.007$^{**}$ & 0.001 & 0.001 & 0.001 & 0.001 & 0.0005 & 0.0005 \
  & (0.004) & (0.004) & (0.003) & (0.003) & (0.003) & (0.003) & (0.002) & (0.002) \
  & & & & & & & & \
 CIT\-\_EST\-\_NonWhite & 0.014 & 0.014 & $-[=10=].004 & $-[=10=].004 & $-[=10=].004 & $-[=10=].004 & $-[=10=].002 & $-[=10=].002 \
  & (0.011) & (0.011) & (0.009) & (0.009) & (0.009) & (0.009) & (0.007) & (0.007) \
  & & & & & & & & \
 CVAP\-\_EST\-\_White & 0.007 & 0.007 & $-[=10=].002 & $-[=10=].002 & $-[=10=].002 & $-[=10=].002 & $-[=10=].001 & $-[=10=].001 \
  & (0.004) & (0.004) & (0.004) & (0.004) & (0.004) & (0.004) & (0.003) & (0.003) \
  & & & & & & & & \
 CVAP\-\_EST\-\_African\-\_American & $-[=10=].007 & $-[=10=].007 & $-[=10=].002 & $-[=10=].002 & $-[=10=].002 & $-[=10=].002 & $-[=10=].001 & $-[=10=].001 \
  & (0.006) & (0.006) & (0.005) & (0.005) & (0.005) & (0.005) & (0.004) & (0.004) \
  & & & & & & & & \
 CVAP\-\_EST\-\_NonWhite & $-[=10=].020 & $-[=10=].020 & 0.006 & 0.006 & 0.006 & 0.006 & 0.002 & 0.002 \
  & (0.016) & (0.016) & (0.014) & (0.014) & (0.014) & (0.014) & (0.010) & (0.010) \
  & & & & & & & & \
 Constant & $-.099 & $-.099 & 5.245 & 5.245 & 5.244 & 5.241 & 1.899 & 1.898 \
  & (14.561) & (14.561) & (12.598) & (12.599) & (12.608) & (12.609) & (8.972) & (8.972) \
  & & & & & & & & \
\hline \[-1.8ex]
Observations & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 & 9,594 \
R$^{2}$ & 0.778 & 0.778 & 0.660 & 0.660 & 0.659 & 0.659 & 0.664 & 0.664 \
Adjusted R$^{2}$ & 0.654 & 0.654 & 0.468 & 0.468 & 0.468 & 0.468 & 0.476 & 0.476 \
Residual Std. Error & 0.403  & 0.403  & 0.348  & 0.348  & 0.349  & 0.349  & 0.248  & 0.248  \
df & xxx & xxx & xxx & xxx & xxx & xxx & xxx & xxx \
F Statistic & 6.250$^{***}$  & 6.249$^{***}$  & 3.452$^{***}$ & 3.450$^{***}$  & 3.443$^{***}$  & 3.442$^{***}$  & 3.524$^{***}$ & 3.523$^{***}$  \
df & xxx & xxx & xxx & xxx & xxx & xxx & xxx & xxx \
\hline
\hline \[-1.8ex]
\textit{Note:}  & \multicolumn{8}{r}{$^{*}$p$<[=10=].1; $^{**}$p$<[=10=].05; $^{***}$p$<[=10=].01} \
\end{longtable} 
\end{document}