Latex:横向表格超出了文本宽度

Latex:横向表格超出了文本宽度

我无法调整(横向)表格的大小以适应文本。我尝试了很多不同的方法,但它总是超出文本宽度。任何帮助表示感谢:

\begin{sidewaystable}[!htbp] 
\setlength\extrarowheight{-5pt} 
\centering 
\caption{Evaluation of Economic Relevance After \cite{konstantinidi2016}: $PostVol$} 
\label{PostVol} 
\begin{adjustbox}{width=\textwidth} 
\begin{tabularx}{\textwidth}{ccccccccccc} 
\toprule \toprule {} & $BS-KP$ & $BS-CH$ & $BS-INT$ & $KP-KP$ & $KP-CH$ & $KP-INT$ & $CH-KP$ & $CH-CH$ & $CH-INT$  \\ \midrule Risk Frc & 0.0177 & 0.0137 & 0.0167 & 0.0483 & 0.0428 & 0.0507 & 0.0016 & 0.0009 & 0.0016 \\
  & (0.0513) & (0.043) & (0.038) & (0.0201) & (0.0305) & (0.0125) & (0.0814) & (0.1228) & (0.0829) \\
 $PreVol$ & 0.6814 & 0.6817 & 0.6814 & 0.6821 & 0.6819 & 0.682 & 0.682 & 0.682 & 0.682 \\
  & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) \\
 $Beta$ & -0.1722 & -0.17 & -0.1726 & -0.1684 & -0.1701 & -0.167 & -0.1696 & -0.1701 & -0.1689 \\
  & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) \\
 $Illiquidity$ & 52.4493 & 52.4433 & 52.3215 & 52.0779 & 52.4123 & 51.9598 & 52.474 & 52.5342 & 52.4644 \\
  & (0.0005) & (0.0005) & (0.0005) & (0.0006) & (0.0005) & (0.0006) & (0.0005) & (0.0005) & (0.0005) \\
 $MV$ & -0.214 & -0.2121 & -0.2133 & -0.2164 & -0.2141 & -0.217 & -0.2111 & -0.2095 & -0.2111 \\
  & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) \\
 $NegBV$ & -0.1352 & -0.1501 & -0.1354 & -0.1432 & -0.1497 & -0.1419 & -0.1496 & -0.153 & -0.1485 \\
  & (0.3269) & (0.267) & (0.3245) & (0.2972) & (0.2591) & (0.3006) & (0.2748) & (0.2627) & (0.2785) \\
 $BM$ & 0.0566 & 0.0643 & 0.0571 & 0.0542 & 0.0638 & 0.0546 & 0.0621 & 0.0649 & 0.0625 \\
  & (0.0267) & (0.0134) & (0.0266) & (0.0284) & (0.0137) & (0.0287) & (0.0165) & (0.0128) & (0.0159) \\
 $BMxNegBV$ & -0.3719 & -0.3853 & -0.374 & -0.3658 & -0.3705 & -0.3645 & -0.3937 & -0.4018 & -0.3931 \\
  & (0.3336) & (0.3074) & (0.3301) & (0.3425) & (0.3237) & (0.3429) & (0.3037) & (0.2899) & (0.3044) \\
 $DE$ & -0.0017 & -0.0009 & -0.0019 & -0.0023 & -0.0012 & -0.0027 & -0.0011 & -0.0006 & -0.0012 \\
  & (0.8386) & (0.9107) & (0.8195) & (0.7902) & (0.8897) & (0.7497) & (0.8954) & (0.9428) & (0.8905) \\
 $DExNegBV$ & -0.0151 & -0.0183 & -0.015 & -0.0158 & -0.0182 & -0.0152 & -0.0181 & -0.0191 & -0.018 \\
  & (0.4036) & (0.3281) & (0.407) & (0.3961) & (0.3302) & (0.4096) & (0.3294) & (0.3077) & (0.3317) \\
 $IPO$ & -55.4484 & -55.3856 & -55.2996 & -55.0941 & -55.3949 & -54.9687 & -55.4191 & -55.4554 & -55.4114 \\
  & (0.0002) & (0.0002) & (0.0002) & (0.0003) & (0.0002) & (0.0003) & (0.0002) & (0.0002) & (0.0002) \\
 $EarnVol$ & 0.0003 & 0.0003 & 0.0003 & 0.0003 & 0.0003 & 0.0003 & 0.0003 & 0.0003 & 0.0003 \\
  & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) & (0.0) \\
 $EQ$ & 0.8884 & 0.8899 & 0.8819 & 0.8494 & 0.8661 & 0.83 & 0.9178 & 0.9333 & 0.9164 \\
  & (0.0001) & (0.0001) & (0.0001) & (0.0002) & (0.0002) & (0.0002) & (0.0) & (0.0) & (0.0) \\
 $NegE$ & 0.0999 & 0.1087 & 0.1033 & 0.1162 & 0.1057 & 0.1125 & 0.1149 & 0.1134 & 0.1145 \\
  & (0.004) & (0.0008) & (0.0024) & (0.0003) & (0.0012) & (0.0005) & (0.0003) & (0.0004) & (0.0003) \\
\midrule $R^{2}$ & 0.7587 & 0.7586 & 0.7587 & 0.7587 & 0.7586 & 0.7587 & 0.7586 & 0.7585 & 0.7586 \\
 $N$ & 14494 & 14494 & 14494 & 14494 & 14494 & 14494 & 14494 & 14494 & 14494 \\
\bottomrule 
\end{tabularx} 
\end{adjustbox} 
\end{sidewaystable}

答案1

  • 请始终提供一个小而完整的文档来重现您的问题。
  • 在`tabularx table 处使用 \begin{adjustbox}{width=\textwidth} 是有意义的。删除它!
  • 如果使用tabularx表,则至少有一列必须是X其派生类型。因此,如果您替换
\begin{tabularx}{\textwidth}{ccccccccccc}

其中C在文档序言中定义为

\newcolumntype{C}{<b\centering\arraybackslash}X}

比你的代码片段

\begin{sidewaystable}[!htbp] 
% no   \setlength\extrarowheight{-5pt} 
\setlength\tabcolsep{3pt}
% no   \begin{adjustbox}{width=\textwidth} 
\begin{tabularx}{\textwidth}{@{} l *{9}{C} @{}}
%
% table body as is
%
\end{tabularx} 
% no   \end{adjustbox} 
\end{sidewaystable}

文档中考虑的这些变化article将产生类似这样的结果:

在此处输入图片描述

但是,对于带有数字的列,我会使用包S的列siunitx,并最终选择较小的字体大小(如果需要)(取决于页面布局)。

附录:

  • 显然 OP 不会回应提供有关其文档的一些信息的要求 :-(
  • 下面是他的表格的可能解决方案的一个例子,在 MWE 中假设
    • article文档类
    • 页面布局由\usepackage{geometry}
    • 使用的字体newtxtextnewtxmath
    • 表中列出了使用库tblrtabularrayamsmathbooktabs以及siunitx加载相应包的
  • 提出的解决方案可能会对遇到类似问题的人有所帮助,我写它或多或少是为了练习......
\documentclass{article}
\usepackage{geometry}

\usepackage{newtxtext, newtxmath}
\usepackage[skip=1ex]{caption}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs, siunitx}
\usepackage{rotating}


\begin{document}
    \begin{sidewaystable}[!htbp]
    \centering
    \caption{Evaluation of Economic Relevance After \cite{konstantinidi2016}: $PostVol$}
    \label{PostVol}
\begin{tblr}{colspec = {@{}  Q[l]
                        *{9}{X[c, si = {table-format=-2.4{)},
                                        input-open-uncertainty=,
                                        input-close-uncertainty=,
                                        table-align-text-before=false,
                                        table-align-text-after=false
                                        }]}
                        @{}},
             cell{2-X}{1} = {font=\itshape},
             cell{Y,Z}{1} = {mode=math, fg=red},
             row{1}   = {guard, font=\itshape},
             row{Z}   = {guard},
             row{even[2-Y]} = {rowsep=0pt},
             row{odd[3-Y]}  = {abovesep+=-2pt, belowsep+=2pt},
             }
    \toprule
    & BS-KP     & BS-CH     & BS-INT    & KP-KP     & KP-CH
    & KP-INT    & CH-KP     & CH-CH     & CH-INT    \\
    \midrule
\text{Risk Frc}
    &  0.0177   &  0.0137   &  0.0167   &  0.0483   &  0.0428
    &  0.0507   &  0.0016   &  0.0009   &  0.0016   \\
    & (0.0513)  & (0.043)   & (0.038)   & (0.0201)  & (0.0305)
    & (0.0125)  & (0.0814)  & (0.1228)  & (0.0829)  \\
PreVol
    &  0.6814   &  0.6817   &  0.6814   &  0.6821   &  0.6819
    &  0.682    &  0.682    &  0.682    &  0.682    \\
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     & (0.0)
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     \\
Beta
    & -0.1722   & -0.17     & -0.1726   & -0.1684   & -0.1701
    & -0.167    & -0.1696   & -0.1701   & -0.1689   \\
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     & (0.0)
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     \\
Illiquidity
    & 52.4493   & 52.4433   & 52.3215   & 52.0779   & 52.4123
    & 51.9598   & 52.474    & 52.5342   & 52.4644   \\
    & (0.0005)  & (0.0005)  & (0.0005)  & (0.0006)  & (0.0005)
    & (0.0006)  & (0.0005)  & (0.0005)  & (0.0005)  \\
MV
    & -0.214    & -0.2121   & -0.2133   & -0.2164   & -0.2141
    & -0.217    & -0.2111   & -0.2095   & -0.2111   \\
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     & (0.0)
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     \\
NegBV
    & -0.1352   & -0.1501   & -0.1354   & -0.1432   & -0.1497
    & -0.1419   & -0.1496   & -0.153    & -0.1485   \\
    & (0.3269)  & (0.267)   & (0.3245)  & (0.2972)  & (0.2591)
    & (0.3006)  & (0.2748)  & (0.2627)  & (0.2785)  \\
BM
    &  0.0566   &  0.0643   &  0.0571   &  0.0542   &  0.0638
    &  0.0546   &  0.0621   &  0.0649   &  0.0625   \\
    & (0.0267)  & (0.0134)  & (0.0266)  & (0.0284)  & (0.0137)
    & (0.0287)  & (0.0165)  & (0.0128)  & (0.0159) \\
BMxNegBV
    & -0.3719   & -0.3853   & -0.374    & -0.3658   & -0.3705
    & -0.3645   & -0.3937   & -0.4018   & -0.3931   \\
    & (0.3336)  & (0.3074)  & (0.3301)  & (0.3425)  & (0.3237)
    & (0.3429)  & (0.3037)   & (0.2899) & (0.3044)  \\
DE
    & -0.0017   & -0.0009   & -0.0019   & -0.0023   & -0.0012
    & -0.0027   & -0.0011   & -0.0006   & -0.0012   \\
    & (0.8386)  & (0.9107)  & (0.8195)  & (0.7902)  & (0.8897)
    & (0.7497)  & (0.8954)  & (0.9428)  & (0.8905)  \\
DExNegBV
    & -0.0151   & -0.0183   & -0.015    & -0.0158   & -0.0182
    & -0.0152   & -0.0181   & -0.0191   & -0.018    \\
    & (0.4036)  & (0.3281)  & (0.407)   & (0.3961)  & (0.3302)
    & (0.4096)  & (0.3294)  & (0.3077)  & (0.3317)  \\
IPO
    & -55.4484  & -55.3856  & -55.2996  & -55.0941  & -55.3949
    & -54.9687  & -55.4191  & -55.4554  & -55.4114  \\
    & (0.0002)  & (0.0002)  & (0.0002)  & (0.0003)  & (0.0002)
    & (0.0003)  & (0.0002)  & (0.0002)  & (0.0002)  \\
EarnVol
    &  0.0003   &  0.0003   &  0.0003   &  0.0003   &  0.0003
    &  0.0003   &  0.0003   &  0.0003   &  0.0003   \\
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     & (0.0)
    & (0.0)     & (0.0)     & (0.0)     & (0.0)     \\
EQ
    &  0.8884   &  0.8899   &  0.8819   &  0.8494   &  0.8661
    &  0.83     &  0.9178   &  0.9333   &  0.9164   \\
    & (0.0001)  & (0.0001)  & (0.0001)  & (0.0002)  & (0.0002)
    & (0.0002)  & (0.0)     & (0.0)     & (0.0)     \\
NegE
    &  0.0999   &  0.1087   &  0.1033   &  0.1162   &  0.1057
    &  0.1125   &  0.1149   &  0.1134   &  0.1145 \\
    & (0.004)   & (0.0008)  & (0.0024)  & (0.0003)  & (0.0012)
    & (0.0005)  & (0.0003)  & (0.0004)  & (0.0003) \\
    \midrule
R^{2}
    &  0.7587   &  0.7586   &  0.7587   &  0.7587   &  0.7586
    &  0.7587   &  0.7586   &  0.7585   &  0.7586   \\
N   & 14494     & 14494     & 14494     & 14494     & 14494
    & 14494     & 14494     & 14494     & 14494    \\
    \bottomrule 
\end{tblr}
    \end{sidewaystable}
\end{document}

在此处输入图片描述

答案2

您可以这样做。首先,减小字体大小,然后减小水平和垂直间距。使用字体相关的宏并避免缩放。如果可能,您还可以减少一些有效数字。

以下是我建议的代码。由于表格太大,我添加了突出显示作为提高阅读能力的指导。相反,您可以尝试添加额外的规则或增加某些行的间距,通过在 后附加单位长度来强调行组,\\例如\\[6pt]

\documentclass{article}
\usepackage{array}
% \usepackage{graphicx}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage[subrefformat=parens]{subcaption}
\captionsetup{position=bottom,skip=0pt}
\captionsetup[subfigure]{belowskip=-6pt}
\newlength\offset


\begin{document}
\begin{sidewaystable}[!htbp] 
  % \setlength\extrarowheight{-5pt}
  \footnotesize
  \rowcolors*{1}{black!10}{}
  \setlength{\tabcolsep}{2pt}
  \captionsetup{position=top,skip=6pt}
  \centering 
  \caption{Evaluation of Economic Relevance After \cite{konstantinidi2016}: $PostVol$} 
  \label{PostVol}
  \begin{tabularx}{0.8\textwidth}{
        >{\cellcolor{white}\itshape}l<{\normalfont} @{\quad}
        *{10}{>{\centering\arraybackslash}X}
    } 
    \toprule\toprule\hiderowcolors
                & $BS-KP$  & $BS-CH$  & $BS-INT$ & $KP-KP$  & $KP-CH$  & $KP-INT$ & $CH-KP$  & $CH-CH$  & $CH-INT$  \\
    \midrule\showrowcolors
    Risk Frc    & 0.0177   & 0.0137   & 0.0167   & 0.0483   & 0.0428   & 0.0507   & 0.0016   & 0.0009   & 0.0016 \\
                & (0.0513) & (0.043)  & (0.038)  & (0.0201) & (0.0305) & (0.0125) & (0.0814) & (0.1228) & (0.0829) \\
    PreVol      & 0.6814   & 0.6817   & 0.6814   & 0.6821   & 0.6819   & 0.682    & 0.682    & 0.682    & 0.682 \\
                & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0) \\
    Beta        & -0.1722  & -0.17    & -0.1726  & -0.1684  & -0.1701  & -0.167   & -0.1696  & -0.1701  & -0.1689 \\
                & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0) \\
    Illiquidity & 52.4493  & 52.4433  & 52.3215  & 52.0779  & 52.4123  & 51.9598  & 52.474   & 52.5342  & 52.4644 \\
                & (0.0005) & (0.0005) & (0.0005) & (0.0006) & (0.0005) & (0.0006) & (0.0005) & (0.0005) & (0.0005) \\
    MV          & -0.214   & -0.2121  & -0.2133  & -0.2164  & -0.2141  & -0.217   & -0.2111  & -0.2095  & -0.2111 \\
                & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0) \\
    NegBV       & -0.1352  & -0.1501  & -0.1354  & -0.1432  & -0.1497  & -0.1419  & -0.1496  & -0.153   & -0.1485 \\
                & (0.3269) & (0.267)  & (0.3245) & (0.2972) & (0.2591) & (0.3006) & (0.2748) & (0.2627) & (0.2785) \\
    BM          & 0.0566   & 0.0643   & 0.0571   & 0.0542   & 0.0638   & 0.0546   & 0.0621   & 0.0649   & 0.0625 \\
                & (0.0267) & (0.0134) & (0.0266) & (0.0284) & (0.0137) & (0.0287) & (0.0165) & (0.0128) & (0.0159) \\
    BMxNegBV    & -0.3719  & -0.3853  & -0.374   & -0.3658  & -0.3705  & -0.3645  & -0.3937  & -0.4018  & -0.3931 \\
                & (0.3336) & (0.3074) & (0.3301) & (0.3425) & (0.3237) & (0.3429) & (0.3037) & (0.2899) & (0.3044) \\
    DE          & -0.0017  & -0.0009  & -0.0019  & -0.0023  & -0.0012  & -0.0027  & -0.0011  & -0.0006  & -0.0012 \\
                & (0.8386) & (0.9107) & (0.8195) & (0.7902) & (0.8897) & (0.7497) & (0.8954) & (0.9428) & (0.8905) \\
    DExNegBV    & -0.0151  & -0.0183  & -0.015   & -0.0158  & -0.0182  & -0.0152  & -0.0181  & -0.0191  & -0.018 \\
                & (0.4036) & (0.3281) & (0.407)  & (0.3961) & (0.3302) & (0.4096) & (0.3294) & (0.3077) & (0.3317) \\
    IPO         & -55.4484 & -55.3856 & -55.2996 & -55.0941 & -55.3949 & -54.9687 & -55.4191 & -55.4554 & -55.4114 \\
                & (0.0002) & (0.0002) & (0.0002) & (0.0003) & (0.0002) & (0.0003) & (0.0002) & (0.0002) & (0.0002) \\
    EarnVol     & 0.0003   & 0.0003   & 0.0003   & 0.0003   & 0.0003   & 0.0003   & 0.0003   & 0.0003   & 0.0003 \\
                & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0)    & (0.0) \\
    EQ          & 0.8884   & 0.8899   & 0.8819   & 0.8494   & 0.8661   & 0.83     & 0.9178   & 0.9333   & 0.9164 \\
                & (0.0001) & (0.0001) & (0.0001) & (0.0002) & (0.0002) & (0.0002) & (0.0)    & (0.0)    & (0.0) \\
    NegE        & 0.0999   & 0.1087   & 0.1033   & 0.1162   & 0.1057   & 0.1125   & 0.1149   & 0.1134   & 0.1145 \\
                & (0.004)  & (0.0008) & (0.0024) & (0.0003) & (0.0012) & (0.0005) & (0.0003) & (0.0004) & (0.0003) \\
    \midrule\hiderowcolors
    R$^2$       & 0.7587   & 0.7586   & 0.7587   & 0.7587   & 0.7586   & 0.7587   & 0.7586   & 0.7585   & 0.7586 \\
    N           & 14494    & 14494    & 14494    & 14494    & 14494    & 14494    & 14494    & 14494    & 14494 \\
    \bottomrule 
    \end{tabularx} 
  \end{sidewaystable}
\end{document}

在此处输入图片描述

相关内容