1
\documentclass{article}
\usepackage{booktabs,rotating,array,dcolumn,caption,amsmath, textcomp}
\usepackage{booktabs,caption}
\usepackage{microtype}
\usepackage{charter}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[margin=2.5cm,a4paper]{geometry}
\begin{document}
    \begin{table}
        \scriptsize % 30% linear reduction in size
        \captionsetup{skip=0.333\baselineskip,font=footnotesize}
        \caption{Add caption}
        \label{tab:addlabel}

        \setlength{\tabcolsep}{0pt} % make LaTeX figure out intercol. space
        \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{10}{d{2.5}r} }
            \toprule
\toprule
Variables & \multicolumn{10}{c}{Decisions} \\
\cmidrule{2-10}
& \multicolumn{2}{c}{Healthcare}
& \multicolumn{2}{c}{Social}
& \multicolumn{2}{c}{Consumption} 
& \multicolumn{2}{c}{Financial} 
& \multicolumn{2}{c}{All} \\
\cmidrule{2-3} \cmidrule{4-5} \cmidrule{6-7} \cmidrule{8-9} \cmidrule{9-10} 
\bottomrule
\end{tabular*}
\begin{tablenotes}
\small
\item Source: Authors'   calculations.\\
Standard errors in parentheses \\
{***} p$<$0.01, {**} p$<$0.05, {*} p$<$0.1
\end{tablenotes}
\end{table}

1 Answers1

2
  • Your code contains an unfortunate mixture of indicators that the tabular* environment should contain either 10 or 20 data columns, for a total of either 11 or 21 columns. In the code below, I provide suggestions for how to fix up your code to make it contain either 11 or 21 columns.

  • Loading the threeparttable package and using its tablenotes environment seems like overkill, especially since you don't appear to use any \tnote directives.

  • Don't load packages more than once.

Here goes:

enter image description here

\documentclass{article}
\usepackage[margin=2.5cm,a4paper]{geometry}
\usepackage{booktabs,rotating,array,dcolumn,caption,
            amsmath,textcomp,microtype,charter}
\newcolumntype{d}[1]{D..{#1}}
\begin{document}

\begin{table}
\captionsetup{skip=0.333\baselineskip, font=footnotesize}
\scriptsize % 30% linear reduction in size
\setlength{\tabcolsep}{0pt} % make LaTeX figure out intercol. space

%%%%%%%%%%%%%%%%%%%%%
%% Possibility 1: 21 columns
\caption{21 columns} \label{tab:21}
%% '*{10}{d{2.5}r}' actually specifies 20, not 10, columns
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{10}{d{2.5}r} }
\toprule %%% please don't ever use double \toprule
Variables & \multicolumn{20}{c}{Decisions} \\
\cmidrule{2-21}
& \multicolumn{4}{c}{Healthcare}
& \multicolumn{4}{c}{Social}
& \multicolumn{4}{c}{Consumption} 
& \multicolumn{4}{c}{Financial} 
& \multicolumn{4}{c}{All} \\
\cmidrule{2-5} \cmidrule{6-9} \cmidrule{10-13} \cmidrule{14-17} \cmidrule{18-21} 
& a & b & c & d 
& a & b & c & d 
& a & b & c & d 
& a & b & c & d 
& a & b & c & d \\
\midrule
\dots \\
\bottomrule
\end{tabular*}

\smallskip
Source: Author's calculations

Standard errors in parentheses

{***} $p<0.01$; {**} $p<0.05$; {*} $p<0.1$

\vspace{1cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Possibility 2: 11 columns

\caption{11 columns} \label{tab:11}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{10}{r} }
\toprule %%% please don't ever use double \toprule!
Variables & \multicolumn{10}{c}{Decisions} \\
\cmidrule{2-11}
& \multicolumn{2}{c}{Healthcare}
& \multicolumn{2}{c}{Social}
& \multicolumn{2}{c}{Consumption} 
& \multicolumn{2}{c}{Financial} 
& \multicolumn{2}{c}{All} \\
\cmidrule{2-3} \cmidrule{4-5} \cmidrule{6-7} \cmidrule{8-9} \cmidrule{10-11} 
& a & b 
& a & b 
& a & b 
& a & b 
& a & b \\
\midrule
\dots \\
\bottomrule
\end{tabular*}

\smallskip
Source: Author's calculations

Standard errors in parentheses

$^{***}$ $p<0.01$; $^{**}$ $p<0.05$; $^{*}$ $p<0.1$
\end{table}
\end{document}
Mico
  • 506,678