0

I have a wide table (more than in the MWE if I start putting numbers in there) and use resizebox to fit it. However, in the threeparttable environment it does not let me put the footnotes inside the rescaled box, which is why they exceed the width of the table. Any suggestions how to approach this?

    \documentclass[12pt]{article}
    \usepackage{authblk}
    \renewcommand\Affilfont{\tiny}  
    \usepackage[a4paper,total={6in, 8in}]{geometry}
    \usepackage[parfill]{parskip}
    \usepackage{hyphenat}
    \usepackage{setspace}
    \usepackage{titlesec} 
    \usepackage[hang,flushmargin]{footmisc}
    \usepackage{pdflscape, longtable}
    \usepackage[strict]{changepage}
    \usepackage{array}
    \usepackage{enumitem}
    \usepackage{booktabs}
    \usepackage[flushleft]{threeparttable}
    \usepackage{adjustbox}
    \usepackage{xltabular}
    \usepackage{enumitem}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{hyperref} 
    \usepackage{tabularx}
    \usepackage{multirow}
\begin{document}

\begin{center}
\begin{table}[ht]
\setlength{\tabcolsep}{12pt}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\centering
\begin{threeparttable}
\resizebox{\textwidth}{!}{%
\begin{tabular}{l ccc ccc ccc ccc}
\hline\hline
\addlinespace[1ex]
& \multicolumn{3}{c}{\textbf{OLS}} & \multicolumn{3}{c}{\textbf{PPML}} & \multicolumn{3}{c}{\textbf{Tobit}} & \multicolumn{3}{c}{\textbf{LSTM}}  \\ 
\addlinespace[1ex]

\cmidrule(r){2-4} \cmidrule(l){5-7} \cmidrule(l){8-10} \cmidrule(l){11-13}
\addlinespace[1ex]
& (1) & (2) & (3) & (1) & (2) & (3) & (1) & (2) & (3) & (1) & (2) & (3) \\
\addlinespace[1ex]
\hline
\addlinespace[1ex]
\textbf{In-sample}  &   &  & &  &  &  &   &  &   & &  &                \\
\addlinespace[0.5ex]
\hspace{2mm} (Pseudo-)$R^{2}$  & &  &  &  &   &    &             &      &            &           &             \\
\addlinespace[0.5ex]
\hspace{2mm}  CPC & &  &  &  &  &  & &  &  &  & &             \\
\addlinespace[0.5ex]
\hspace{2mm}  MAPE & & &  &  &  &      &             &             &      &            &           &             \\
\addlinespace[0.5ex]
\hspace{2mm}  RMSE &  &  &  & & & & & &  &  &             \\
\addlinespace[1ex]

\hline\hline
\end{tabular}
}
\begin{tablenotes}
\setlength\labelsep{0pt}
\item{\scriptsize \textit{Blablaaaaaaaaaaaaaaasd  aaaaaaaaaaaaaaaaaaaaaaaaaa   aaaaaaaaaa bla bala aasfsdiovo  srbOBSFdofb just a long text that is longer than the table}.
\end{tablenotes}
\end{threeparttable}
\caption{Some Table}\label{tab:PredPower}
\end{table}
\end{center}

\end{document}

Papayapap
  • 421
  • 2
    try to avoid ever doing \resizebox{\textwidth}{!}{% it makes it impossible to have consistent font sizes or rule widths compared to the rest of the document. – David Carlisle Feb 12 '21 at 14:51
  • 1
    You should never use \resizebox with tables – you'll obtain inconsistent font sizes. Instead, you can change the fontsize at the very beginning of the table environment, and use a smaller value of \tabcolsep (which is 6 pt by default). – Bernard Feb 12 '21 at 14:52
  • also don't put a table inside center it will add spurious vertical space at that point as the teable is a float so may be placed elsewhere but the empty center environment will be there. – David Carlisle Feb 12 '21 at 14:53
  • Thanks for the suggestions. Before using resizebox I did start with using small font and tabcolsep, but it's not enough to shrink the table width to the page. At least resizebox got it done. Is there any other way that forces the table to page width? – Papayapap Feb 12 '21 at 14:56
  • 2
    My table doesn't fit; what are my options? contains a bunch of strategies that can be applied to tables that are wither too wide or to tall for the available space. Which method to use for your table depends a lot on its actual contents. For more specific advice, please prepare a table with dummy contents in each column that are as close to your real contents as possible. – leandriis Feb 12 '21 at 17:59

0 Answers0