1

I have typeset a wide table which looks like this. Please ignore the repetitions in the column values:enter image description here

  • I want floating point values aligned w.r.t decimal point.
  • I also want to keep the values in the 'Estimation Report' to be placed on the left side, not at the centre, the way it appears now.

The code used to generate this table is as follows:

\documentclass[12pt,a4paper,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[inner=1in,outer=1in,tmargin=1in,bmargin=1in]{geometry}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{bm}
\usepackage{caption}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{rotating} % rotate the table
\usepackage{pdflscape}% rotate the page
\usepackage{pdfpages}
\usepackage{multicol}

\usepackage[ group-separator={,} ]{siunitx}
\sisetup{
    output-exponent-marker = \text{\hspace{1pt}e},
    exponent-product={},
    retain-explicit-plus,
    input-open-uncertainty  = ,
    input-close-uncertainty = ,
    table-align-text-pre    = false,
    table-align-text-post = false,
    round-mode=places,
    round-precision=3,
    table-space-text-pre    = (,
    table-space-text-post   = ),
}
\newcolumntype{D}{@{}S[table-format =-3.3e-1]@{}}

\begin{document}
\thispagestyle{empty}
\begin{landscape}
\begin{table}
%\begin{table}[p]
\centering
\begin{minipage}{\linewidth}
\caption{***TABLE CAPTION***} 
\label{***TABLE LABEL***}%
\resizebox{\textwidth}{!}{
\begin{tabular}{l|DDD|DDD|DDD|DDD}
    \multicolumn{13}{@{}l}{\begin{tabular}[l]{l}\Large \textbf{Parameter Estimates}\end{tabular}}\\
    \toprule
    \multirow{2}{*}{\textbf{Parameter}}  & \multicolumn{3}{c|}{\textbf{Model~1}} & \multicolumn{3}{c|}{\textbf{Model~2}} & \multicolumn{3}{c|}{\textbf{Model~3}} & \multicolumn{3}{c}{\textbf{Model~4}}          \\
    \cmidrule(l){2-13}
      & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}}          \\
    \midrule
    $ASC_C$ &  -1.560 & 0.678 & -2.301 & -1.560 & 0.678 & -2.301 & -1.560 & 0.678 & -2.301 & -1.560 & 0.678 & -2.301    \\  
$BTOTIME$ &  -0.024 & 9.020e-03 & -2.676 & -0.024 & 9.020e-03 & -2.676 & -0.024 & 9.020e-03 & -2.676 & -0.024 & 9.020e-03 & -2.676    \\  
$BOVTTDist$ &  -0.307 & 0.081 & -3.798 & -0.307 & 0.081 & -3.798 & -0.307 & 0.081 & -3.798 & -0.307 & 0.081 & -3.798    \\  
$BCOST$ &  -0.843 & 0.121 & -6.973 & -0.843 & 0.121 & -6.973 & -0.843 & 0.121 & -6.973 & -0.843 & 0.121 & -6.973    \\  
$BMale$ &  -0.496 & 0.390 & -1.271 & -0.496 & 0.390 & -1.271 & -0.496 & 0.390 & -1.271 & -0.496 & 0.390 & -1.271    \\  
$BNumVeh$ &  0.639 & 0.253 & 2.521 & 0.639 & 0.253 & 2.521 & 0.639 & 0.253 & 2.521 & 0.639 & 0.253 & 2.521    \\  
$BTRANSFER$ &  -0.541 & 0.462 & -1.170 & -0.541 & 0.462 & -1.170 & -0.541 & 0.462 & -1.170 & -0.541 & 0.462 & -1.170    \\
    \midrule

    \multicolumn{13}{@{}l}{\begin{tabular}[l]{l}\end{tabular}}\\
    \multicolumn{13}{@{}l}{\begin{tabular}[l]{l}\Large \textbf{Estimation Report}\end{tabular}}\\

    \midrule
    Sample Size &  \multicolumn{3}{D|}{543} & \multicolumn{3}{D|}{543} & \multicolumn{3}{D|}{543} & \multicolumn{3}{D}{543}    \\  
Null LL: [$\mathcal{L}(0)$] &  \multicolumn{3}{D|}{-376.379} & \multicolumn{3}{D|}{-376.379} & \multicolumn{3}{D|}{-376.379} & \multicolumn{3}{D}{-376.379}    \\  
Constants-only LL: [$\mathcal{L}(C)$] &  \multicolumn{3}{D|}{-216.197} & \multicolumn{3}{D|}{-216.197} & \multicolumn{3}{D|}{-216.197} & \multicolumn{3}{D}{-216.197}    \\  
\midrule
\# Estimated Parameters &  \multicolumn{3}{D|}{7} & \multicolumn{3}{D|}{7} & \multicolumn{3}{D|}{7} & \multicolumn{3}{D}{7}    \\  
Final LL: [$\mathcal{L}(\hat{\beta})$] &  \multicolumn{3}{D|}{-103.524} & \multicolumn{3}{D|}{-103.524} & \multicolumn{3}{D|}{-103.524} & \multicolumn{3}{D}{-103.524}    \\  
$\rho^2$ &  \multicolumn{3}{D|}{0.725} & \multicolumn{3}{D|}{0.725} & \multicolumn{3}{D|}{0.725} & \multicolumn{3}{D}{0.725}    \\  
$\rho_c^2$ &  \multicolumn{3}{D|}{0.521} & \multicolumn{3}{D|}{0.521} & \multicolumn{3}{D|}{0.521} & \multicolumn{3}{D}{0.521}    \\  
$\overline{\rho}^2$ &  \multicolumn{3}{D|}{0.706} & \multicolumn{3}{D|}{0.706} & \multicolumn{3}{D|}{0.706} & \multicolumn{3}{D}{0.706}    \\  
$\overline{\rho_c}^2$ &  \multicolumn{3}{D|}{0.491} & \multicolumn{3}{D|}{0.491} & \multicolumn{3}{D|}{0.491} & \multicolumn{3}{D}{0.491}    \\  
AIC &  \multicolumn{3}{D|}{221.049} & \multicolumn{3}{D|}{221.049} & \multicolumn{3}{D|}{221.049} & \multicolumn{3}{D}{221.049}    \\  
AICc &  \multicolumn{3}{D|}{221.258} & \multicolumn{3}{D|}{221.258} & \multicolumn{3}{D|}{221.258} & \multicolumn{3}{D}{221.258}    \\  
BIC &  \multicolumn{3}{D|}{251.129} & \multicolumn{3}{D|}{251.129} & \multicolumn{3}{D|}{251.129} & \multicolumn{3}{D}{251.129}    \\  
Success(Y=1, N=0)? &  \multicolumn{3}{D|}{1} & \multicolumn{3}{D|}{1} & \multicolumn{3}{D|}{1} & \multicolumn{3}{D}{1}    \\
\bottomrule

\end{tabular}
}
\end{minipage}
\end{table}%
\end{landscape}

\end{document}

I want to improve the formatting of this table as well as remove the extra spacing between the columns. Kindly offer your inputs.

TRK
  • 389
  • Maybe relevant: https://tex.stackexchange.com/questions/332902/my-table-doesnt-fit-what-are-my-options – Matsmath Feb 13 '20 at 11:39

1 Answers1

2

enter image description here

  • not used \resizebox, rather decrease font size to \footnotesize
  • S columns are adopted to each column
  • removed are table-space-text-pre and table-space-text-post
  • instead of tabulars is used one common tabular*
  • removed except in table headers all \multicolumns
  • determination of spaces between column is left to LaTeX
\documentclass[12pt,a4paper,twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[inner=1in,outer=1in,tmargin=1in,bmargin=1in]{geometry}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{bm}
\usepackage{caption}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{rotating} % rotate the table
\usepackage{pdflscape}% rotate the page
\usepackage{pdfpages}
\usepackage{multicol}

\usepackage[ group-separator={,} ]{siunitx}
\sisetup{
    output-exponent-marker = \text{\hspace{1pt}e},
    exponent-product={},
    retain-explicit-plus,
    input-open-uncertainty  = ,
    input-close-uncertainty = ,
    table-align-text-pre    = false,
    table-align-text-post = false,
    round-mode=places,
    round-precision=3,
%    table-space-text-pre    = (,
%    table-space-text-post   = ),
}
%\newcolumntype{D}{@{}S[table-format =-3.3e-1]@{}}

\begin{document}
\thispagestyle{empty}
\begin{landscape}
\begin{table}
    \setlength\tabcolsep{0pt}
    \footnotesize
\caption{***TABLE CAPTION***}
\label{***TABLE LABEL***}%
\begin{tabular*}{\linewidth}
                {@{\extracolsep{\fill}} l *{4}{S[table-format=-3.3]
                                               S[table-format=1.3e-1]
                                               S[table-format=-1.3]}
                }
\multicolumn{13}{@{}l}{\Large\textbf{Parameter Estimates}}  \\
    \midrule[\heavyrulewidth]
\multirow{2.3}{*}{\textbf{Parameter}}  
    &   \multicolumn{3}{c}{\textbf{Model~1}} 
        &   \multicolumn{3}{c}{\textbf{Model~2}} 
            & \multicolumn{3}{c}{\textbf{Model~3}} 
                & \multicolumn{3}{c}{\textbf{Model~4}}                  \\
    \cmidrule(l){2-4}
    \cmidrule(l){5-7}
    \cmidrule(l){8-10}
    \cmidrule(l){11-13}
    & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} 
    & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} 
    & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}} 
    & {\textbf{Value}} & {\textbf{Std err}} & {\textbf{t-test}}         \\
    \midrule
ASC\textsubscript{C}
    &   -1.560  & 0.678     & -2.301 & -1.560 & 0.678       & -2.301 
    &   -1.560  & 0.678     & -2.301 & -1.560 & 0.678       & -2.301    \\
BTOTIME
    &  -0.024 & 9.020e-03   & -2.676 & -0.024 & 9.020e-03   & -2.676 
    &  -0.024 & 9.020e-03   & -2.676 & -0.024 & 9.020e-03   & -2.676    \\
BOVTTDist
    &  -0.307 & 0.081       & -3.798 & -0.307 & 0.081       & -3.798 
    &  -0.307 & 0.081       & -3.798 & -0.307 & 0.081       & -3.798    \\
BCOST
    &  -0.843 & 0.121       & -6.973 & -0.843 & 0.121       & -6.973 
    &  -0.843 & 0.121       & -6.973 & -0.843 & 0.121       & -6.973    \\
BMale
    &  -0.496 & 0.390       & -1.271 & -0.496 & 0.390       & -1.271 
    &  -0.496 & 0.390       & -1.271 & -0.496 & 0.390       & -1.271    \\
BNumVeh
    &  0.639  & 0.253       &  2.521 &  0.639 & 0.253       &  2.521 
    &  0.639  & 0.253       &  2.521 &  0.639 & 0.253       &  2.521    \\
BTRANSFER
    &  -0.541 & 0.462       & -1.170 & -0.541 & 0.462       & -1.170 
    &  -0.541 & 0.462       & -1.170 & -0.541 & 0.462       & -1.170    \\
    \midrule    \\

\multicolumn{13}{@{}l}{\Large\textbf{Estimation Report}}                \\
    \midrule
Sample Size 
    &  543      &   &   & 543       &   &   & 543       &   &   & 543       &   &   \\
Null LL: [$\mathcal{L}(0)$] 
    & -376.379  &   &   & -376.379  &   &   & -376.379  &   &   & -376.379  &   &   \\
Constants-only LL: [$\mathcal{L}(C)$] 
    & -216.197  &   &   & -216.197  &   &   & -216.197  &   &   & -216.197  &   &   \\
\midrule
\# Estimated Parameters 
    & 7         &   &   & 7         &   &   & 7         &   &   & 7         &   &   \\
Final LL: [$\mathcal{L}(\hat{\beta})$] 
    & -103.524  &   &   & -103.524  &   &   & -103.524  &   &   & -103.524  &   &   \\
$\rho^2$ 
    &  0.725    &   &   & 0.725     &   &   & 0.725     &   &   & 0.725     &   &   \\
$\rho_c^2$      
    & 0.521     &   &   & 0.521     &   &   & 0.521     &   &   & 0.521     &   &   \\
$\overline{\rho}^2$ 
    & 0.706     &   &   & 0.706     &   &   & 0.706     &   &   & 0.706     &   &   \\
$\overline{\rho_c}^2$ 
    & 0.491     &   &   &  0.491    &   &   & 0.491     &   &   & 0.491     &   &   \\
AIC & 221.049   &   &   & 221.049   &   &   & 221.049   &   &   & 221.049   &   &   \\
AICc 
    & 221.258   &   &   & 221.258   &   &   & 221.258   &   &   & 221.258   &   &   \\
BIC & 251.129   &   &   & 251.129   &   &   & 251.129   &   &   & 251.129   &   &   \\
Success(Y=1, N=0)? 
    & 1         &   &   & 1         &   &   & 1         &   &   & 1         &   &   \\
    \bottomrule
\end{tabular*}
    \end{table}
\end{landscape}
Zarko
  • 296,517