2
  1. I would like to have the attached table (threeparttable) to run across the whole page (landscape) and have columns 2 to 33 of same width (tabularx).
  2. I would like to have the headers in the first two rows of column 1 to be formatted like those in this picture.

enter image description here

I know the table design is not ideal, but I need to display all the information on one single page and to me this is the only way possible. Any help is greatly appreciated!

\documentclass[authoryear,11pt]{elsarticle}

%Packages
\usepackage[utf8]{inputenc}
%\usepackage[latin1]{inputenc}
%\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, eurosym}
\usepackage{lscape}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\usepackage{setspace}
\usepackage{graphicx, rotating}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage[table]{xcolor}
\usepackage{booktabs, makecell, longtable, tabularx, threeparttable}
\usepackage[font=small]{caption}
\usepackage{soul}
\usepackage{endnotes}
\usepackage{siunitx}
%\usepackage{endfloat} %package puts tables and figures to the end
\usepackage[breaklinks=true,hidelinks,colorlinks=true,linkcolor=blauelsevier,urlcolor=blauelsevier, citecolor=blauelsevier]{hyperref}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{tabu}
\usepackage{pdflscape}
\usepackage{scrhack} 
\usepackage{selinput}

\robustify{\bfseries}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\newenvironment{mytable}{\begin{center}\begin{footnotesize}\begin{onehalfspacing}}{\end{onehalfspacing}\end{footnotesize}\end{center}}

%Settings
\makeatletter
\def\ps@pprintTitle{%
  \let\@oddhead\@empty
  \let\@evenhead\@empty
  \def\@oddfoot{\leftline{\footnotesize \textit{\today}}}%
  \let\@evenfoot\@empty
}
\makeatother
%\DeclareDelayedFloatFlavor{sidewaysfigure}{figure}
%\DeclareDelayedFloatFlavor{sidewaystable}{table}
%\DeclareDelayedFloatFlavour{threeparttable}{table}
%\DeclareDelayedFloatFlavour{longtable}{table}


%11pt
\setlength\textheight{215mm}
\setlength\textwidth{140mm}
\setlength\marginparwidth{00mm}
\setlength\oddsidemargin{12.5mm}
\setlength\topmargin{-10mm}
\addtolength{\footnotesep}{0.5mm}

%12pt
%\setlength\textheight{225mm}
%\setlength\textwidth{140mm}
%\setlength\marginparwidth{00mm}
%\setlength\oddsidemargin{15mm}
%\setlength\topmargin{-10mm}
%\addtolength{\footnotesep}{0.5mm}


%Cover page
\begin{document}

%\vspace*{\fill}

%\begin{sidewaystable}
\begin{landscape}

%\setlength\tabcolsep{4pt} % default: 6pt
\tiny
\singlespacing
%\centering
\sisetup{detect-weight}

\renewcommand\theadfont{\tiny}
\settowidth{\rotheadsize}{\tiny\bfseries Totall}
\renewcommand{\theadalign}{bc}

\begin{threeparttable}

\caption{\label{tab:tab_reformdata} tbd}

\begin{tabularx}{\textheight}{@{}
                       lCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC@{}}
    \toprule

        \thead{(1)} & \thead{(2)} & \thead{(3)} & \thead{(4)} & \thead{(5)} & \thead{(6)} & \thead{(7)}  & \thead{(8)}  & \thead{(9)}  & \thead{(10)}  & \thead{(11)}  & \thead{(12)}  & \thead{(13)}  & \thead{(14)}  & \thead{(15)}  & \thead{(16)} & \thead{(17)}  & \thead{(18)}  & \thead{(19)}  & \thead{(20)}  & \thead{(21)}  & \thead{(22)}  & \thead{(23)}  & \thead{(24)}  & \thead{(25)}  & \thead{(26)} & \thead{(27)} & \thead{(28)} & \thead{(29)} & \thead{(30)} & \thead{(31)} & \thead{(32)} & \thead{(33)}\\

        \cmidrule{1-33} 

    \thead[lb]{\bfseries Country}
    & \rothead{\bfseries 1985} 
        & \rothead{\bfseries 1986}
    & \rothead{\bfseries 1987}
    & \rothead{\bfseries 1988}
    & \rothead{\bfseries 1989}
    & \rothead{\bfseries 1990}
    & \rothead{\bfseries 1991}
    & \rothead{\bfseries 1992}
    & \rothead{\bfseries 1993}
    & \rothead{\bfseries 1994}
    & \rothead{\bfseries 1995}
    & \rothead{\bfseries 1996}
    & \rothead{\bfseries 1997}
    & \rothead{\bfseries 1998}
    & \rothead{\bfseries 1999}
    & \rothead{\bfseries 2000}
    & \rothead{\bfseries 2001}
    & \rothead{\bfseries 2002}
    & \rothead{\bfseries 2003}
    & \rothead{\bfseries 2004}
    & \rothead{\bfseries 2005}
    & \rothead{\bfseries 2006}
    & \rothead{\bfseries 2007}
    & \rothead{\bfseries 2008}
    & \rothead{\bfseries 2009}
    & \rothead{\bfseries 2010}
    & \rothead{\bfseries 2011}
    & \rothead{\bfseries 2012}
    & \rothead{\bfseries 2013}
    & \rothead{\bfseries 2014}
    & \rothead{\bfseries 2015}
    & \rothead{\bfseries Total}\\

\midrule
Austria &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       & \textbf{2} \\
Belgium &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       & \textbf{2} \\
Denmark &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       & \textbf{2} \\
Finland &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{2} \\
France & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       & \textbf{2} \\
Germany &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       & \textbf{2} \\
Greece &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       & \multicolumn{1}{c}{D} &       &       &       & \multicolumn{1}{c}{D} & \textbf{4} \\
Ireland &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       & \textbf{2} \\
Italy &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       & \multicolumn{1}{c}{D} & \multicolumn{1}{c}{C} &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       & \textbf{4} \\
Luxembourg &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       & \textbf{1} \\
Netherlands &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{0} \\
Portugal &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{N} &       &       &       & \textbf{2} \\
Spain &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       & \multicolumn{1}{c}{N} &       &       & \multicolumn{1}{c}{D} &       & \textbf{3} \\
Sweden &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{2} \\
UK    &       & \multicolumn{1}{c}{D} &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{3} \\
\textbf{EU15 total} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{2} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{2} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{2} & \textbf{0} & \textbf{3} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{3} & \textbf{3} & \textbf{3} & \textbf{0} & \textbf{2} & \textbf{1} & \textbf{33} \\
      &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &  \\
Brazil &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{1} \\
China &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       & \textbf{1} \\
India &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \textbf{0} \\
Russia &       &       &       &       &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       & \multicolumn{1}{c}{D} &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       & \multicolumn{1}{c}{C} &       & \textbf{5} \\
\textbf{BRIC total} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{7} \\
      &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &  \\
USA   &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       & \multicolumn{1}{c}{C} &       &       &       &       &       &       &       &       &       &       & \textbf{1} \\
      &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &       &  \\
\textbf{Total} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{2} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{2} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{3} & \textbf{0} & \textbf{4} & \textbf{2} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{3} & \textbf{3} & \textbf{3} & \textbf{0} & \textbf{3} & \textbf{1} & \textbf{41} \\
\bottomrule

\end{tabularx}%

\begin{tablenotes}[flushleft]\labelsep0.0em
\item \footnotesize Notes: tbd
\end{tablenotes}

\end{threeparttable}
\par

\end{landscape}
%\end{sidewaystable}

%\vspace*{\fill}

\end{document}

enter image description here

1 Answer 1

2
  • for some reason tabularx doesn't work if it contain more than 20 columns, therefore i replace it with tabular*
  • table is huge ... to fit on page i enlarge (with \newgeometry) page width
  • in mwe below i omit all packages which are not relevant to table
  • also are removed all unnecessary `\multicolumn{1}{c{...}˙
  • definition of \theadfont is changed to \newcommand\theadfont{\bfseries\scriptsize}. consequently use of thead{...} is simpler

considering aforementioned the table is:

enter image description here

\documentclass[authoryear,11pt]{elsarticle}

\usepackage[a4paper,
            hmargin={30mm,20mm},
            vmargin={30mm,30mm}
            ]{geometry}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, eurosym}

\usepackage{pdflscape}

\usepackage{rotating}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx, threeparttable}
\newcolumntype{C}[1]{>{\Centering}p{#1}}
\usepackage{siunitx}

\usepackage[font=small]{caption}

\usepackage{lipsum}

\begin{document}

\newgeometry{showframe,
             hmargin={30mm,30mm},
             vmargin={7mm,13mm}
             }
\begin{landscape}
    \centering
    \scriptsize
\renewcommand\theadfont{\scriptsize\bfseries}
\settowidth{\rotheadsize}{\theadfont Total}
\setlength\tabcolsep{1pt}
%
\begin{threeparttable}
    \caption{tbd}
\label{tab:tab_reformdata}
%
\begin{tabular*}{\hsize}{l@{\extracolsep{\fill}}
                    *{31}{C{6ex}}
              >{\bfseries}S[table-format=2.0,
                            detect-weight]
                         }
    \toprule
\thead{(1)}
              & \thead{(2)}  & \thead{(3)}  & \thead{(4)}   & \thead{(5)}   &
\thead{(6)}   & \thead{(7)}  & \thead{(8)}  & \thead{(9)}   & \thead{(10)}  &
\thead{(11)}  & \thead{(12)} & \thead{(13)} & \thead{(14)}  & \thead{(15)}  &
\thead{(16)}  & \thead{(17)} & \thead{(18)} & \thead{(19)}  & \thead{(20)}  &
\thead{(21)}  & \thead{(22)} & \thead{(23)} & \thead{(24)}  & \thead{(25)}  &
\thead{(26)}  & \thead{(27)} & \thead{(28)} & \thead{(29)}  & \thead{(30)}  &
\thead{(31)}  & \thead{(32)} & {\thead{(33)}}
                    \\  \midrule
\thead[lb]{Country}
    & \rothead{1985}    & \rothead{1986}    & \rothead{1987}    & \rothead{1988}
    & \rothead{1989}    & \rothead{1990}    & \rothead{1991}    & \rothead{1992}
    & \rothead{1993}    & \rothead{1994}    & \rothead{1995}    & \rothead{1996}
    & \rothead{1997}    & \rothead{1998}    & \rothead{1999}    & \rothead{2000}
    & \rothead{2001}    & \rothead{2002}    & \rothead{2003}    & \rothead{2004}
    & \rothead{2005}    & \rothead{2006}    & \rothead{2007}    & \rothead{2008}
    & \rothead{2009}    & \rothead{2010}    & \rothead{2011}    & \rothead{2012}
    & \rothead{2013}    & \rothead{2014}    & \rothead{2015}    & {\rothead{Total}}
                    \\  \midrule
Austria &   &   &   &   &   &   &   &   &   &
        &   &   & D &   &   &   &   &   &   &
        &   &   &   &   &   & D &   &   &   &
        &   & 2     \\
Austria &   &   &   &   &   &   &   &   &   &
        &   &   & D &   &   &   &   &   &   &
        &   &   &   &   &   & D &   &   &   &
        &   & 2     \\
Belgium &   &   &   &   &   &   &   &   &   &
        &   &   & D &   &   &   &   &   &   &
        &   &   &   &   &   & D &   &   &   &
        &   & 2     \\
Denmark &   &   &   &   &   &   &   &   &   &
        &   & C &   &   &   &   &   &   &   &
        &   &   &   &   &   & C &   &   &   &
        &   & 2     \\
Finland &   &   &   &   &   &   &   &   & D &
        &   &   &   &   &   &   &   &   & C &
        &   &   &   &   &   &   &   &   &   &
        &   & 2     \\
France  & D &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        & D &   &   &   &   &   &   &   &   &
        &   & 2     \\
Germany &   &   &   &   &   &   &   &   &   & C
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   & C &   &
        &   & 2     \\
Greece  &   &   &   &   &   & D &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   & D &   &   &   & D &   &   &
        & D & 4     \\
Ireland &   &   &   &   &   & D &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   & D
        &   & 2     \\
Italy   &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   & D &
        & D & C &   &   &   &   &   & D &   &
        &   & 4     \\
Luxembourg
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        & C &   &   &   &   &   &   &   &   &
        &   & 1     \\
Netherlands
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   & 0     \\
Portugal&   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   & N &   &
        &   & 2     \\
Spain   &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   & C &   & N &   &   & D
        &   & 3     \\
Sweden  &   &   & C &   &   &   &   &   &   &
        &   & C &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   & 2     \\
UK      &   & D &   &   &   &   &   &   &   &
        &   &   &   &   &   & D &   & C &   &
        &   &   &   &   &   &   &   &   &   &
        &   & 3     \\
\textbf{EU15 total}
    & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{2} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{2} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{2} & \textbf{0} & \textbf{3} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{3} & \textbf{3} & \textbf{3} & \textbf{0} & \textbf{2} & \textbf{1} & {\textbf{33}} \\
    \addlinespace
Brazil  &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   & C &
        &   &   &   &   &   &   &   &   &   &
        &   & 1     \\
China   &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   & C &   &   &   &   &   &   &   &
        &   & 1     \\
India   &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        &   & 0     \\
Russia  &   &   &   &   &   &   &   & D &   &
        &   &   &   & C &   &   &   & D &   &
        &   &   &   & C &   &   &   &   &   & C
        &   & 5     \\
\textbf{BRIC total}
    & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{0} & \textbf{1} & \textbf{0} & {\textbf{7}} \\
    \addlinespace
USA     &   &   &   &   &   &   &   &   &   &
        &   &   &   &   &   &   &   &   &   &
        & C &   &   &   &   &   &   &   &   &
        &   & 1     \\
    \addlinespace
\textbf{Total}
    & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{0} & \textbf{2} & \textbf{0} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{2} & \textbf{1} & \textbf{0} & \textbf{1} & \textbf{0} & \textbf{2} & \textbf{3} & \textbf{0} & \textbf{4} & \textbf{2} & \textbf{1} & \textbf{1} & \textbf{1} & \textbf{3} & \textbf{3} & \textbf{3} & \textbf{0} & \textbf{3} & \textbf{1} & {\textbf{41}} \\
\bottomrule
    \end{tabular*}
\begin{tablenotes}[para,flushleft]
Notes: \lipsum*[22]
\end{tablenotes}
    \end{threeparttable}
    \end{landscape}
\restoregeometry

\end{document}
1
  • @user7378449, does answer help you? or even solve your problem? if so, please express your thankfulness with vote and even consider to accept it :-)
    – Zarko
    Sep 25, 2017 at 12:47

You must log in to answer this question.

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