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}
  • 3
    Welcome to TeX.SX! What is your question? – Phelype Oleinik Apr 26 '18 at 18:14
  • I am trying to make this table but it's not appear complete. Last columns from 9-10 disappear on the page. – Rashid Javed Apr 26 '18 at 18:18
  • 2
    for tablenotes you need to load threeparttable . – Zarko Apr 26 '18 at 18:19
  • 1
    your table is to wide. you should reduce column width somehow, but without knowing content from table body is difficult to say how to do this. for start reduce font size. – Zarko Apr 26 '18 at 18:23
  • 1
    @RashidJaved The table fits the page for me. You are probably using a paper layout that doesn't fit the table. Maybe this post will help you. Otherwise, please post a MWE that compiles and shows the problem you are having. – Phelype Oleinik Apr 26 '18 at 18:24
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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.