在 Latex 中适应宽表并调整页面大小

在 Latex 中适应宽表并调整页面大小

我有这张表:

\begin{landscape}
\begin{table}
  \centering
   \caption{Effects of air pollution in ER admissions by age groups in Mexicali}
   \label{tab:app_age_zinb_mx}
   

  \resizebox{\textwidth}{!}{


        \begin{tabular}{lcccccccccccc}
        
    \toprule
\\[-1.8ex] & \multicolumn{12}{c}{\textbf{ER Admissions}} \\[.8ex]

& \multicolumn{3}{c}{\textbf{PM$_{2.5}$ (75+)}} &\multicolumn{3}{c}{\textbf{NO$_{2}$ (75+)}} &\multicolumn{3}{c}{\textbf{PM$_{2.5}$ (0-5)}} &\multicolumn{3}{c}{\textbf{NO$_{2}$ (0-5)}}\\ [.8ex]
       &Lag=1 & Lag=2 & Lag=3 & Lag=1 & Lag=2 & Lag=3 &Lag=1 & Lag=2 & Lag=3 & Lag=1 & Lag=2 & Lag=3 \\ [.8ex]
        & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10) &(11) & (12)\\ \midrule
        & \multicolumn{12}{c}{\textbf{Negative binomial}} \\ [.8ex]
Constant & -1.389$^{***}$ & -1.221$^{***}$ & -1.285$^{***}$ &  -1.386$^{***}$& -1.398$^{***}$ & -1.313$^{***}$ &  0.091 &  0.007 &  0.348 & -0.310$^{***}$ & -0.354$^{***}$ & -0.400$^{***}$ \\ 
   & ( 0.345) & ( 0.347) & ( 0.361) & (  0.332) & ( 0.343) & ( 0.318) & ( 0.188) & ( 0.189) & ( 0.193) & ( 0.157) & ( 0.158) & ( 0.162) \\ 
  Pollutant &  0.016 &  0.042 &  0.036 &   0.014 &  0.026 &  0.028 &  0.001 & -0.005 & -0.006 &  0.012 &  0.010 &  0.008 \\ 
   & ( 0.034) & ( 0.026) & ( 0.027) & (  0.026) & ( 0.020) & ( 0.024) & ( 0.012) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\ 
  Pollutant lag &  0.035 & -0.008 &  0.003 &   0.036 &  0.024 &  0.017 & -0.007 &  0.005 &  0.005 &  0.017$^{**}$ &  0.023$^{***}$ &  0.027$^{***}$ \\ 
   & ( 0.034) & ( 0.024) & ( 0.028) & (  0.030) & ( 0.023) & ( 0.026) & ( 0.013) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\ 
  Trend &  0.151 &  0.206 &  0.204 &   0.124 &  0.162 &  0.147 &  0.440$^{***}$ &  0.435$^{***}$ &  0.450$^{***}$ &  0.349$^{***}$ &  0.345$^{***}$ &  0.360$^{***}$ \\ 
   & ( 0.221) & ( 0.219) & ( 0.219) & (  0.190) & ( 0.198) & ( 0.196) & ( 0.118) & ( 0.118) & ( 0.119) & ( 0.099) & ( 0.098) & ( 0.098) \\[.8ex] 
   & \multicolumn{12}{c}{\textbf{Zero-inflated}} \\ [.8ex]
  Constant & -1.138 & -1.125 & -1.110 &  -0.400 & -0.544 & -0.411 & -0.488 & -0.545 & -0.727 &  0.244 &  0.316 &  0.387 \\ 
   & ( 0.740) & ( 0.736) & ( 0.757) & (  0.707) & ( 0.736) & ( 0.651) & ( 0.469) & ( 0.476) & ( 0.502) & ( 0.324) & ( 0.329) & ( 0.337) \\ 
  Pollutant &  0.091 &  0.108$^{**}$ &  0.103$^{**}$ &   0.046 &  0.027 &  0.021 &  0.039 &  0.036 &  0.027 &  0.002 & -0.006 & -0.002 \\ 
   & ( 0.072) & ( 0.056) & ( 0.058) & (  0.055) & ( 0.041) & ( 0.049) & ( 0.031) & ( 0.030) & ( 0.030) & ( 0.024) & ( 0.021) & ( 0.021) \\ 
  Pollutant lag &  0.008 & -0.013 & -0.009 &  -0.011 &  0.018 &  0.016 & -0.020 & -0.013 &  0.011 & -0.043$^{**}$ & -0.040$^{**}$ & -0.051$^{***}$ \\ 
   & ( 0.069) & ( 0.048) & ( 0.057) & (  0.065) & ( 0.048) & ( 0.053) & ( 0.032) & ( 0.031) & ( 0.032) & ( 0.024) & ( 0.021) & ( 0.021) \\ 
  Trend & -0.390 & -0.345 & -0.340 &  -0.353 & -0.312 & -0.329 & -0.851$^{***}$ & -0.854$^{***}$ & -0.856$^{***}$ & -0.725$^{***}$ & -0.731$^{***}$ & -0.740$^{***}$ \\ 
   & ( 0.417) & ( 0.412) & ( 0.413) & (  0.364) & ( 0.379) & ( 0.373) & ( 0.268) & ( 0.269) & ( 0.272) & ( 0.225) & ( 0.225) & ( 0.227) \\ \midrule 
   N observations & 433 & 433 & 433 & 433 & 433 & 433 & 1380 & 1380 & 1380 & 1380 & 1380 & 1380 \\
  Dispersion parameter &  555514.507 & 1165112.235 &  455913.539 &   89734.880 &  227164.613 &  150688.597 &       2.494 &       2.462 &       2.449 &       2.907 &       3.026 &       3.044 \\ 
  AIC &    1689.249 &    1685.436 &    1685.043 &    1883.727 &    1884.437 &    1885.301 &    3349.339 &    3348.409 &    3341.986 &    3652.969 &    3643.089 &    3625.998 \\ 
  BIC &    1735.506 &    1731.686 &    1731.285 &    1930.989 &    1931.693 &    1932.550 &    3395.596 &    3394.659 &    3388.228 &    3700.231 &    3690.345 &    3673.247 \\ 
  TIC &    1687.482 &    1682.223 &    1681.999 &    1882.537 &    1882.563 &    1884.029 &    3348.384 &    3347.167 &    3341.139 &    3651.995 &    3642.318 &    3625.142 \\ \bottomrule
    \end{tabular}}
   
   
   
 \end{table}
   \end{landscape}

问题是该页面太宽,与其余页面不合适。

我希望它像我以图像形式附加的表格一样适合;我该怎么做?在此处输入图片描述

答案1

我的主要建议是将 12 个数据列中的数字与小数点对齐。并且,在标题材料上提供更多视觉结构。哦,不要滥用大胆的

请注意,只要边距不是太宽,就不需要手动或用大力气减小字体大小\resizebox

在此处输入图片描述

\documentclass{article} % or some other suitable document class
\usepackage[a4paper,margin=2.5cm]{geometry} % set as appropriate
\usepackage{booktabs} % for well-spaced horizontal lines
\usepackage{rotating} % for 'sidewaystable' env.
\usepackage{mhchem}   % for '\ce'  macro
\usepackage{dcolumn}  % to align numbers on their decimal markers
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

% Cf. Marcel Krüger's answer at https://tex.stackexchange.com/a/694046/5001 
\usepackage{floatpag,pdflscape}
\makeatletter
\newcommand{\rotateview}{\global\@namedef{\number\@currbox @float}{\PLS@AddRotate{90}%
  \AddToHookNext{shipout/after}{\PLS@RemoveRotate}}}
\makeatother

\begin{document} 

\begin{sidewaystable}
\rotateview

\caption{Effects of air pollution on ER admissions, by age groups in Mexicali}
\label{tab:app_age_zinb_mx}

\setlength\tabcolsep{0pt} % make LaTeX figure out intercolumn whitespace padding

\bigskip
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{12}{d{2.6}} }

\toprule
& \multicolumn{12}{c}{ER Admissions} \\
\cmidrule{2-13}

& \multicolumn{3}{c}{PM\textsubscript{2.5} (75+)}
& \multicolumn{3}{c}{\ce{NO2}   (75+)}
& \multicolumn{3}{c}{PM\textsubscript{2.5} (0--5)}
& \multicolumn{3}{c}{\ce{NO2}   (0--5)} \\
\cmidrule{2-4} \cmidrule{5-7} \cmidrule{8-10} \cmidrule{11-13}
& \mc{Lag=1} & \mc{Lag=2} & \mc{Lag=3} & \mc{Lag=1} & \mc{Lag=2} & \mc{Lag=3}
& \mc{Lag=1} & \mc{Lag=2} & \mc{Lag=3} & \mc{Lag=1} & \mc{Lag=2} & \mc{Lag=3} \\
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)}  & \mc{(5)}  & \mc{(6)}
& \mc{(7)} & \mc{(8)} & \mc{(9)} & \mc{(10)} & \mc{(11)} & \mc{(12)} \\
\midrule
\addlinespace
\multicolumn{13}{l}{\bfseries Negative binomial} \\
\addlinespace
Constant & -1.389^{***} & -1.221^{***} & -1.285^{***} &  -1.386^{***}& -1.398^{***} & -1.313^{***} &  0.091 &  0.007 &  0.348 & -0.310^{***} & -0.354^{***} & -0.400^{***} \\
   & ( 0.345) & ( 0.347) & ( 0.361) & (  0.332) & ( 0.343) & ( 0.318) & ( 0.188) & ( 0.189) & ( 0.193) & ( 0.157) & ( 0.158) & ( 0.162) \\
  Pollutant &  0.016 &  0.042 &  0.036 &   0.014 &  0.026 &  0.028 &  0.001 & -0.005 & -0.006 &  0.012 &  0.010 &  0.008 \\
   & ( 0.034) & ( 0.026) & ( 0.027) & (  0.026) & ( 0.020) & ( 0.024) & ( 0.012) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\
  Pollutant, lagged &  0.035 & -0.008 &  0.003 &   0.036 &  0.024 &  0.017 & -0.007 &  0.005 &  0.005 &  0.017^{**} &  0.023^{***} &  0.027^{***} \\
   & ( 0.034) & ( 0.024) & ( 0.028) & (  0.030) & ( 0.023) & ( 0.026) & ( 0.013) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\
  Trend &  0.151 &  0.206 &  0.204 &   0.124 &  0.162 &  0.147 &  0.440^{***} &  0.435^{***} &  0.450^{***} &  0.349^{***} &  0.345^{***} &  0.360^{***} \\
   & ( 0.221) & ( 0.219) & ( 0.219) & (  0.190) & ( 0.198) & ( 0.196) & ( 0.118) & ( 0.118) & ( 0.119) & ( 0.099) & ( 0.098) & ( 0.098) \\
\addlinespace
\multicolumn{13}{l}{\bfseries Zero-inflated} \\
\addlinespace
  Constant & -1.138 & -1.125 & -1.110 &  -0.400 & -0.544 & -0.411 & -0.488 & -0.545 & -0.727 &  0.244 &  0.316 &  0.387 \\
   & ( 0.740) & ( 0.736) & ( 0.757) & (  0.707) & ( 0.736) & ( 0.651) & ( 0.469) & ( 0.476) & ( 0.502) & ( 0.324) & ( 0.329) & ( 0.337) \\
  Pollutant &  0.091 &  0.108^{**} &  0.103^{**} &   0.046 &  0.027 &  0.021 &  0.039 &  0.036 &  0.027 &  0.002 & -0.006 & -0.002 \\
   & ( 0.072) & ( 0.056) & ( 0.058) & (  0.055) & ( 0.041) & ( 0.049) & ( 0.031) & ( 0.030) & ( 0.030) & ( 0.024) & ( 0.021) & ( 0.021) \\
  Pollutant, lagged &  0.008 & -0.013 & -0.009 &  -0.011 &  0.018 &  0.016 & -0.020 & -0.013 &  0.011 & -0.043^{**} & -0.040^{**} & -0.051^{***} \\
   & ( 0.069) & ( 0.048) & ( 0.057) & (  0.065) & ( 0.048) & ( 0.053) & ( 0.032) & ( 0.031) & ( 0.032) & ( 0.024) & ( 0.021) & ( 0.021) \\
  Trend & -0.390 & -0.345 & -0.340 &  -0.353 & -0.312 & -0.329 & -0.851^{***} & -0.854^{***} & -0.856^{***} & -0.725^{***} & -0.731^{***} & -0.740^{***} \\
   & ( 0.417) & ( 0.412) & ( 0.413) & (  0.364) & ( 0.379) & ( 0.373) & ( 0.268) & ( 0.269) & ( 0.272) & ( 0.225) & ( 0.225) & ( 0.227) \\
\midrule
No.\ of obs. & \mc{433} & \mc{433} & \mc{433} & \mc{433} & \mc{433} & \mc{433} & \mc{1380} & \mc{1380} & \mc{1380} & \mc{1380} & \mc{1380} & \mc{1380} \\
Disp.\ param. & \mc{555514.507} & \mc{1165112.235} & \mc{455913.539} & \mc{89734.880} & \mc{227164.613} & \mc{150688.597} & \mc{2.494} & \mc{2.462} & \mc{2.449} & \mc{ 2.907} & \mc{3.026} & \mc{3.044} \\
AIC & \mc{1689.249} & \mc{1685.436} & \mc{1685.043} & \mc{1883.727} & \mc{1884.437} & \mc{1885.301} & \mc{3349.339} & \mc{3348.409} & \mc{ 3341.986} & \mc{3652.969} & \mc{3643.089} & \mc{3625.998} \\
BIC & \mc{1735.506} & \mc{1731.686} & \mc{1731.285} & \mc{1930.989} & \mc{1931.693} & \mc{1932.550} & \mc{3395.596} & \mc{3394.659} & \mc{ 3388.228} & \mc{3700.231} & \mc{3690.345} & \mc{3673.247} \\
TIC & \mc{1687.482} & \mc{1682.223} & \mc{1681.999} & \mc{1882.537} & \mc{1882.563} & \mc{1884.029} & \mc{3348.384} & \mc{3347.167} & \mc{ 3341.139} & \mc{3651.995} & \mc{3642.318} & \mc{3625.142} \\
\bottomrule
\end{tabular*}

\end{sidewaystable}

\end{document}

答案2

看看以下建议是否能满足您的要求:

\documentclass{article}
\usepackage{pdflscape}
\usepackage{array, booktabs}

\begin{document}
\begin{landscape}
\begin{table}
  \centering
   \caption{Effects of air pollution in ER admissions by age groups in Mexicali}
   \label{tab:app_age_zinb_mx}

\footnotesize
\setlength\tabcolsep{0pt}
  \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} >{\raggedright}m{6.6em} cccccccccccc}
    \toprule
    & \multicolumn{12}{c}{\textbf{ER Admissions}} \\
    \midrule
    & \multicolumn{3}{c}{\textbf{PM$_{2.5}$ (75+)}} 
        &\multicolumn{3}{c}{\textbf{NO$_{2}$ (75+)}} 
            &\multicolumn{3}{c}{\textbf{PM$_{2.5}$ (0-5)}} 
                &\multicolumn{3}{c}{\textbf{NO$_{2}$ (0-5)}}\\ [.8ex]
    &Lag=1 & Lag=2 & Lag=3 & Lag=1 & Lag=2 & Lag=3 &Lag=1 & Lag=2 & Lag=3 & Lag=1 & Lag=2 & Lag=3 \\ [.8ex]
    & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10) &(11) & (12)\\
    \midrule
    & \multicolumn{12}{c}{\textbf{Negative binomial}} \\ [.8ex]
Constant 
    & -1.389$^{***}$ & -1.221$^{***}$ & -1.285$^{***}$ &  -1.386$^{***}$& -1.398$^{***}$ & -1.313$^{***}$ &  0.091 &  0.007 &  0.348 & -0.310$^{***}$ & -0.354$^{***}$ & -0.400$^{***}$ \\
    & ( 0.345) & ( 0.347) & ( 0.361) & (  0.332) & ( 0.343) & ( 0.318) & ( 0.188) & ( 0.189) & ( 0.193) & ( 0.157) & ( 0.158) & ( 0.162) \\
Pollutant 
    &  0.016 &  0.042 &  0.036 &   0.014 &  0.026 &  0.028 &  0.001 & -0.005 & -0.006 &  0.012 &  0.010 &  0.008 \\
   & ( 0.034) & ( 0.026) & ( 0.027) & (  0.026) & ( 0.020) & ( 0.024) & ( 0.012) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\
Pollutant lag 
    &  0.035 & -0.008 &  0.003 &   0.036 &  0.024 &  0.017 & -0.007 &  0.005 &  0.005 &  0.017$^{**}$ &  0.023$^{***}$ &  0.027$^{***}$ \\
    & ( 0.034) & ( 0.024) & ( 0.028) & (  0.030) & ( 0.023) & ( 0.026) & ( 0.013) & ( 0.012) & ( 0.012) & ( 0.010) & ( 0.008) & ( 0.008) \\
Trend 
    &  0.151 &  0.206 &  0.204 &   0.124 &  0.162 &  0.147 &  0.440$^{***}$ &  0.435$^{***}$ &  0.450$^{***}$ &  0.349$^{***}$ &  0.345$^{***}$ &  0.360$^{***}$ \\
    & ( 0.221) & ( 0.219) & ( 0.219) & (  0.190) & ( 0.198) & ( 0.196) & ( 0.118) & ( 0.118) & ( 0.119) & ( 0.099) & ( 0.098) & ( 0.098) \\[.8ex]
    & \multicolumn{12}{c}{\textbf{Zero-inflated}} \\ [.8ex]
Constant & -1.138 & -1.125 & -1.110 &  -0.400 & -0.544 & -0.411 & -0.488 & -0.545 & -0.727 &  0.244 &  0.316 &  0.387 \\
   & ( 0.740) & ( 0.736) & ( 0.757) & (  0.707) & ( 0.736) & ( 0.651) & ( 0.469) & ( 0.476) & ( 0.502) & ( 0.324) & ( 0.329) & ( 0.337) \\
Pollutant 
    &  0.091 &  0.108$^{**}$ &  0.103$^{**}$ &   0.046 &  0.027 &  0.021 &  0.039 &  0.036 &  0.027 &  0.002 & -0.006 & -0.002 \\
    & ( 0.072) & ( 0.056) & ( 0.058) & (  0.055) & ( 0.041) & ( 0.049) & ( 0.031) & ( 0.030) & ( 0.030) & ( 0.024) & ( 0.021) & ( 0.021) \\
Pollutant lag &  0.008 & -0.013 & -0.009 &  -0.011 &  0.018 &  0.016 & -0.020 & -0.013 &  0.011 & -0.043$^{**}$ & -0.040$^{**}$ & -0.051$^{***}$ \\
    & ( 0.069) & ( 0.048) & ( 0.057) & (  0.065) & ( 0.048) & ( 0.053) & ( 0.032) & ( 0.031) & ( 0.032) & ( 0.024) & ( 0.021) & ( 0.021) \\
Trend 
    & -0.390 & -0.345 & -0.340 &  -0.353 & -0.312 & -0.329 & -0.851$^{***}$ & -0.854$^{***}$ & -0.856$^{***}$ & -0.725$^{***}$ & -0.731$^{***}$ & -0.740$^{***}$ \\
   & ( 0.417) & ( 0.412) & ( 0.413) & (  0.364) & ( 0.379) & ( 0.373) & ( 0.268) & ( 0.269) & ( 0.272) & ( 0.225) & ( 0.225) & ( 0.227) \\ \midrule
N observations 
    & 433 & 433 & 433 & 433 & 433 & 433 & 1380 & 1380 & 1380 & 1380 & 1380 & 1380 \\
Dispersion parameter &  555514.507 & 1165112.235 &  455913.539 &   89734.880 &  227164.613 &  150688.597 &       2.494 &       2.462 &       2.449 &       2.907 &       3.026 &       3.044 \\
AIC &    1689.249 &    1685.436 &    1685.043 &    1883.727 &    1884.437 &    1885.301 &    3349.339 &    3348.409 &    3341.986 &    3652.969 &    3643.089 &    3625.998 \\
BIC &    1735.506 &    1731.686 &    1731.285 &    1930.989 &    1931.693 &    1932.550 &    3395.596 &    3394.659 &    3388.228 &    3700.231 &    3690.345 &    3673.247 \\
TIC &    1687.482 &    1682.223 &    1681.999 &    1882.537 &    1882.563 &    1884.029 &    3348.384 &    3347.167 &    3341.139 &    3651.995 &    3642.318 &    3625.142 \\ 
    \bottomrule
\end{tabular*}
    \end{table}
\end{landscape}
\end{document}

在此处输入图片描述

我没有干涉表格设计,但是我会重新考虑它的设计。使用siunitxthreeparttable将使表格看起来更美观。

相关内容