0

I have a problem adjusting the size of my (sideways-)table to fit the text. I tried a lot of different things, but it keeps exceeding the text width. Any help appreciated:

\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 can only adjust the width of your table if you have at least one X column. Dec 6, 2022 at 16:31

2 Answers 2

1
  • Please always provide a small but complete document, which reproduce your problem.
  • Use \begin{adjustbox}{width=\textwidth} at `tabularx table has any sense. Remove it!
  • If you use tabularx table, at least one column must be of X or from it derived type. So if you replace
\begin{tabularx}{\textwidth}{ccccccccccc}

where C is defined in document preamble with

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

than your code fragment is

\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}

This changes consider in article document will produce something similar to this:

enter image description here

However, for columns with numbers I would use S columns of siunitx package and eventually select smaller font size if will be needed (depends on page layout).

Addendum:

  • apparently OP will not respond on ask for providing some information about his document :-(
  • so below is an example of possible solution for his table, In MWE are assumed
    • article document class
    • page layout is determined by \usepackage{geometry}
    • used fonts are newtxtext and newtxmath
    • for table are used tblr of tabularray package with libraries amsmath, booktabs and siunitx which load corresponding packages
  • Proposed solution may help anyone with similar problems, I wrote it more or les for exercise ...
\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}

enter image description here

2
  • Thanks for your answer! Really appreciate the effort! Now I just scaled down the size of the whole table using \scalebox{0.7}{. I only need to fit table notes to the new size now and I'm done.
    – Luca
    Dec 7, 2022 at 10:30
  • @Luca, first, please extend your document fragment in question to complete small document with your table (that we can see document preamble), than add table notes (so far are not present in code fragment) and try to consider my comment at end of answer. After this I I (or anyone) be able to help you improving your table. For example on the similae way as can be seen in tex.stackexchange.com/questions/667568/….
    – Zarko
    Dec 7, 2022 at 11:23
0

Here's what you can do. First, reduce font size, followed by smaller horizontal and vertical spacing. Use font related macros and avoid scaling. You could also reduce a number of significant digits, if possible.

Below is code with my suggestions. I added highlighting as a guidance for improve reading because the table is huge. Instead, you could try to add extra rules or increase spacing in certain rows to emphasise row groups by appending a unit length to \\, e.g. \\[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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .