长表宽度超出页面

长表宽度超出页面

我看到了这些话题,确实它们很有帮助,

将长表调整为横向页面的宽度

如何使横向多页表适合文本宽度

但由于某种原因,它仍然不能解决我的问题。我有这张桌子

\begin{landscape}
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}|*{19}{c|}}
\caption[Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012]{Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012.} \label{grid_mlmmh} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & 
\\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  
\\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & Coeff & $\Delta$Prob  & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob  \\ 
\endfirsthead
\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & 
\\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  
\\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & & & Coeff & $\Delta$Prob  &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob  \\ 
\endhead
\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
 \midrule
PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8  &  &  0.021  & 0.018 & & 0.043 & 0.146 & & 0.074 &  0.427 & & 0.019 & 0.427 & & 0.019 & 0.427   \\ 

Log-likelihood
\\
$Pseudo-R^{2}$ \\ \\
Non-PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8    & 0.021  & 0.018 &  0.043 & 0.146 &  0.074 &  0.427 &  0.019 & 0.427 & & 0.019 & 0.427   \\ 


\\
$Pseudo-R^{2}$ \\ \\
\end{longtable}
\end{landscape}

而且它总是超出页面。此外,左侧的第一个“\delta Prob”列总是比其他列大。。您能帮我把这个表格调整到页面宽度,并确保所有列的大小相同吗?我可能做错了什么!

谢谢你!

答案1

我认为问题的根源在于,虽然您将表格定义为总共有 19 列,但实际上只有 13 列(1 个标题列和 12 个数据列)。解决这个问题(主要是通过删除不必要的&对齐字符)可以让表格很好地适应可用空间,而无需切换到较小的字体。

顺便说一句,如果使用该包的规则绘制命令booktabs不应该也使用垂直条,部分原因是垂直线无法与水平线正确连接。

(我仅将图像旋转到 90 度以下以便更容易在此空间中显示。)

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage{lscape,booktabs,longtable}
\begin{document}
\begin{landscape}
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{}l@{\extracolsep{\fill}}*{12}{c}@{}}
\caption{Multinomial logistic regression results for daily data of the major Eurozone, US, and UK market indices, January 1, 2005, to 20 July, 2012.} \label{grid_mlmmh} \\
\toprule
& \multicolumn{6}{c}{Bottom tails} & \multicolumn{6}{c}{Top tails} \\
\cmidrule(r){2-7} \cmidrule(l){8-13} 
% 2 orizonties grammes aristera kai deksia
& \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} 
& \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(6)} \\
\cmidrule(r){2-3}  \cmidrule(lr){4-5}   \cmidrule(lr){6-7} 
\cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(l){12-13}
% 2 orizonties grammes aristera kai deksia \\
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob 
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob \\ 
\midrule
\endfirsthead
\multicolumn{7}{@{}l}%
{{\bfseries \tablename\ \thetable{} --- continued from previous page}} \\
\midrule[\heavyrulewidth]
& \multicolumn{6}{c}{Bottom tails} & \multicolumn{6}{c}{Top tails} \\
\cmidrule(r){2-7} \cmidrule(l){8-13} 
% 2 orizonties grammes aristera kai deksia
& \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} 
& \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(6)} \\
\cmidrule(r){2-3}  \cmidrule(lr){4-5}   \cmidrule(lr){6-7} 
\cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(l){12-13}
% 2 orizonties grammes aristera kai deksia \\
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob 
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob \\ 
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{13}{r}{Continued on next page} \\ 
\endfoot
\bottomrule
\endlastfoot
PIIGS \\
$\beta_{01}$ (const.) 
& 100 & 0.8 & 0.021 & 0.018 & 0.043 & 0.146 & 0.074 & 0.427 & 0.019 & 0.427 & 0.019 & 0.427 \\ 
Log-likel. \\
Pseudo-$R^{2}$ \\[2ex]
Non-PIIGS \\
$\beta_{01}$ (const.) 
& 100 & 0.8 & 0.021 & 0.018 & 0.043 & 0.146 & 0.074 & 0.427 & 0.019 & 0.427 & 0.019 & 0.427 \\ 
Log-likel.\\
Pseudo-$R^{2}$ \\
\end{longtable}
\end{landscape}
\end{document}

答案2

表格c列始终为一行,因此大多数情况下,您只需将其更改为使用p另外,您的“继续”标题(本例中未显示)太宽,无法容纳 3 列,这就是扩展第 3 列的原因。我只是将其增加到 13。

在此处输入图片描述

\documentclass{article}

\usepackage{booktabs,pdflscape,array, longtable}

\begin{document}

\begin{landscape}\small
\setlength\LTcapwidth{\columnwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}|>{\raggedright\arraybackslash}p{2cm}|*{18}{>{\raggedright\arraybackslash}p{.7cm}|}}
\caption[Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012]{Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012.\label{grid_mlmmh}} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & \\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  \\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & Coeff & $\Delta$Prob  & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob  \\ 
\endfirsthead
\multicolumn{13}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & 
\\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  
\\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & & & Coeff & $\Delta$Prob  &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob  \\ 
\endhead
\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
 \midrule
PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8  &  &  0.021  & 0.018 & & 0.043 & 0.146 & & 0.074 &  0.427 & & 0.019 & 0.427 & & 0.019 & 0.427   \\ 

Log-likelihood
\\
$Pseudo-R^{2}$ \\ \\
Non-PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8    & 0.021  & 0.018 &  0.043 & 0.146 &  0.074 &  0.427 &  0.019 & 0.427 & & 0.019 & 0.427   \\ 


\\
$Pseudo-R^{2}$ \\ \\
\end{longtable}
\end{landscape}

\end{document}

相关内容