0

According to this question One header for all subtables: Correct arranging of Columns I am creating a table. Everything works fine except of two things: 1) When I use multicolumn over multiple columns the alignment is not in line anymore. 2) I put table notes on top of the table as well as below the table. For the table notes on top there is a huge gap to the caption of the table.

Moreover, when I add $-$ to the numeric value, there is an error. I solved this by marking that as a "whole package": \mc{$-$123456}

%General Layout
\documentclass[a4paper, 12pt]{article}
\usepackage[left=3cm, right=2cm, top=2cm, bottom=3cm]{geometry}
%Mathematics
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textgreek}
\usepackage{rotating}
\usepackage{tikz}
\usepackage[outdir=./]{epstopdf}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{threeparttable}

\usepackage[labelsep=newline,% line break after label
   justification=raggedright,
   singlelinecheck=off,
   font=sc]{caption}

\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{etoolbox}
\robustify\bfseries 
\sisetup{detect-weight=true,detect-inline-weight=math}
\usepackage{fancybox}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\usepackage{colortbl}
%%%%%%%%%% Journal of Finance requirements %%%%%%%%%%
\renewcommand{\thesection}{\Roman{section}} 
\renewcommand{\thesubsection}{\Alph{subsection}} 
\renewcommand{\thetable}{\Roman{table}} 
\renewcommand{\abstractname}{\textsc{ABSTRACT}}
\makeatletter
% we need a period (.) after sectioning numbers, but not in cites thereto.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}

\long\def\@makefigcaption#1#2{%
 \vskip\abovecaptionskip
 %#1\\\footnotesize#2
 %\sbox\@tempboxa{\footnotesize\bf#1.\footnotesize#2}%
 %\sbox\@tempboxa{\footnotesize{\textbf{#1.}} footnotesize#2}%
 %\sbox\@tempboxa{\textbf{#1.} footnotesize#2}%
 %\sbox\@tempboxa
 \footnotesize\textbf{#1.} \footnotesize#2
 \ifdim \wd\@tempboxa >\hsize
 \textbf{#1.} #2\par
 \else
  \global \@minipagefalse
  \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
 \fi
 \vskip\belowcaptionskip} 

\renewcommand{\figure}{\let\@makecaption\@makefigcaption\@float{figure}}

\long\def\@maketblcaption#1#2{%
 \vskip\abovecaptionskip
 \begin{center}\small\bf#1\\\normalsize#2\end{center}
% \sbox\@tempboxa{\textbf{#1.} #2}%
% \global \@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
 \vskip\belowcaptionskip} 

\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}

\makeatother

%%%%%%%%%% End: Journal of Finance requirements %%%%%%%%%%

\begin{table}[htp!]
\caption{Regression of [0,50] Buy-and-Hold Equity Return on Adjusted DSUE}
\footnotesize
\begin{threeparttable}
\begin{tablenotes}[flushleft]\singlespacing
\setlength\labelsep{0pt}
\item M subtable-specific headnote \\
\end{tablenotes}
\begin{tabular*}{\textwidth}%
  { @{\extracolsep{\fill}} l *{6}{d{2.3}} @{} }
\toprule
& \multicolumn{2}{c}{\hphantom{$-$}(1) DSUE1$\hphantom{^{***}}$} & \multicolumn{2}{c}{\hphantom{$-$}(2) DSUE2$\hphantom{^{***}}$} & \multicolumn{2}{c}{\hphantom{$-$}(3) DSUE3$\hphantom{^{***}}$} \\
\cmidrule{2-3} \cmidrule{4-5} \cmidrule{6-7}
Variables & \mc{\hphantom{$-$}Estimate$\hphantom{^{***}}$} & \mc{\hphantom{$-$}t$-$Value$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Estimate$\hphantom{^{***}}$} & \mc{\hphantom{$-$}t$-$Value$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Estimate$\hphantom{^{***}}$} & \mc{\hphantom{$-$}t$-$Value$\hphantom{^{**}}$} \\ [0.5ex]
\midrule
\multicolumn{7}{l}{\textbf{Panel A:} [0, 50] Buy-and-Hold CDS Return (in \%)} \\ [0.5ex]
Intercept & \mc{$-$0.14$^{***}$} & \mc{$-$2.86$\hphantom{^{**}}$} & \mc{$-$0.14$^{***}$} & \mc{$-$2.64$\hphantom{^{**}}$} & \mc{$-$0.14$^{***}$} & \mc{$-$2.85$\hphantom{^{**}}$} \\
DSUE & \mc{\hphantom{$-$}0.09$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.42$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.09$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.30$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.14$^{*}\hphantom{^{**}}$} & \mc{\hphantom{$-$}1.66$\hphantom{^{**}}$} \\
BHAR & \mc{$-$3.56$^{***}$} & \mc{$-$5.94$\hphantom{^{**}}$} & \mc{$-$3.45$^{***}$} & \mc{$-$5.76$\hphantom{^{**}}$} & \mc{$-$3.53$^{***}$} & \mc{$-$5.59$\hphantom{^{**}}$} \\
$\Delta$VOLA & \mc{\hphantom{$-$}7.45$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.39$\hphantom{^{**}}$} & \mc{\hphantom{$-$}10.99$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.55$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.55$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.04$\hphantom{^{**}}$} \\
$\Delta$LEVERAGE & \mc{\hphantom{$-$}0.86$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.52$\hphantom{^{**}}$} & \mc{\hphantom{$-$}1.04$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.64$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.97$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.40$\hphantom{^{**}}$} \\
UPGRADE & \mc{\hphantom{$-$}0.05$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.04$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.04$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.91$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.06$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.07$\hphantom{^{**}}$} \\
DOWNGRADE & \mc{\hphantom{$-$}0.04$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.73$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.03$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.71$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.02$\hphantom{^{***}}$} & \mc{\hphantom{$-$}0.40$\hphantom{^{**}}$} \\
$\Delta$SPOT & \mc{$-$32.44$^{***}$} & \mc{$-$3.99$\hphantom{^{**}}$} & \mc{$-$32.74$^{***}$} & \mc{$-$4.03$\hphantom{^{**}}$} & \mc{$-$31.92$^{***}$} & \mc{$-$3.64$\hphantom{^{**}}$} \\
$\Delta$SLOPE & \mc{$-$1.87$\hphantom{^{***}}$} & \mc{$-$0.19$\hphantom{^{**}}$} & \mc{$-$2.72$\hphantom{^{***}}$} & \mc{$-$0.29$\hphantom{^{**}}$} & \mc{$-$4.59$\hphantom{^{***}}$} & \mc{$-$0.44$\hphantom{^{**}}$} \\
Time dummies & \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} &  \\
N & \mc{\hphantom{$-$}9,814$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}9,821$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}8,896$\hphantom{^{***}}$} &  \\
Adj. R$^{2}$ & \mc{\hphantom{$-$}0.168$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}0.160$\hphantom{^{***}}$} &  & \mc{\hphantom{$-$}0.161$\hphantom{^{***}}$} & \\ [0.5ex]
\midrule
\multicolumn{7}{l}{\textbf{Panel B: [0, 50]} Buy-and-Hold Equity Return } \\ [0.5ex]
Intercept & \mc{\hphantom{$-$}0.0069$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.39$\hphantom{^{**}}$}
 & \mc{\hphantom{$-$}0.0060$\hphantom{^{***}}$} & \mc{\hphantom{$-$}1.23$\hphantom{^{**}}$} & \mc{$-$0.0011$\hphantom{^{***}}$} & \mc{{$-$}0.20$\hphantom{^{**}}$}\\
DSUE & \mc{\hphantom{$-$}0.0279$^{***}$} & \mc{\hphantom{$-$}5.39$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.0289$^{***}$} & \mc{\hphantom{$-$}6.21$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.0600$^{***}$} & \mc{\hphantom{$-$}11.81$\hphantom{^{***}}$} \\
Time Dummies & \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} & &  \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} & & \mc{\hphantom{$-$}Yes$\hphantom{^{***}}$} \\ 
N & \mc{\hphantom{$-$}13,347$\hphantom{^{***}}$} & & \mc{\hphantom{$-$}13,365$\hphantom{^{***}}$} & & \mc{\hphantom{$-$}12,048$\hphantom{^{***}}$} \\
Adj. R-squared & \mc{\hphantom{$-$}0.0182$\hphantom{^{***}}$} & &  \mc{\hphantom{$-$}0.0182$\hphantom{^{***}}$} & & \mc{\hphantom{$-$}0.0334$\hphantom{^{***}}$} \\ [1ex]
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[a] A subtable-specific footnote

\end{tablenotes}

\end{threeparttable}

\end{table}
\end{document}

thank you very much.

1 Answer 1

2

Here is a way with the siunitx package and the relevant options, which make the code much simpler:

 %General Layout
\documentclass[a4paper, 12pt]{article}
\usepackage[left=3cm, right=2cm, top=2cm, bottom=3cm]{geometry}
%Mathematics
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textgreek}
\usepackage{rotating}
\usepackage{tikz}
\usepackage[outdir=./]{epstopdf}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{setspace}
\usepackage[labelsep=newline,% line break after label
   justification=raggedright,
   singlelinecheck=off,
   font=sc]{caption}

\usepackage{subcaption}
\usepackage{siunitx}
\sisetup{table-format = 2.4,table-number-alignment = center,table-align-text-post = false}%table-parse-only
\usepackage{etoolbox}
\robustify\bfseries
\sisetup{detect-weight=true,detect-inline-weight=math}
\usepackage{fancybox}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{|c}{#1}}
\usepackage{colortbl}
%%%%%%%%%% Journal of Finance requirements %%%%%%%%%%
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thetable}{\Roman{table}}
\renewcommand{\abstractname}{\textsc{ABSTRACT}}
\makeatletter
% we need a period (.) after sectioning numbers, but not in cites thereto.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}

\long\def\@makefigcaption#1#2{%
 \vskip\abovecaptionskip
 %#1\\\footnotesize#2
 %\sbox\@tempboxa{\footnotesize\bf#1.\footnotesize#2}%
 %\sbox\@tempboxa{\footnotesize{\textbf{#1.}} footnotesize#2}%
 %\sbox\@tempboxa{\textbf{#1.} footnotesize#2}%
 %\sbox\@tempboxa
 \footnotesize\textbf{#1.} \footnotesize#2
 \ifdim \wd\@tempboxa >\hsize
 \textbf{#1.} #2\par
 \else
  \global \@minipagefalse
  \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
 \fi
 \vskip\belowcaptionskip}

\renewcommand{\figure}{\let\@makecaption\@makefigcaption\@float{figure}}

\long\def\@maketblcaption#1#2{%
 \vskip\abovecaptionskip
 \begin{center}\small\bf#1\\\normalsize#2\end{center}
% \sbox\@tempboxa{\textbf{#1.} #2}%
% \global \@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
 \vskip\belowcaptionskip}

\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}

\makeatother

%%%%%%%%%% End: Journal of Finance requirements %%%%%%%%%%
\begin{document}

\begin{table}[!htp]
\caption{Regression of [0,50] Buy-and-Hold Equity Return on Adjusted DSUE}
\footnotesize
\begin{threeparttable}
\begin{tablenotes}[flushleft]
\setlength\labelsep{0pt}\scriptsize
\item M subtable-specific headnote
\item Another subtable-specific headnote
\end{tablenotes}
\vskip 1ex
\begin{tabular*}{\textwidth}%
  {@{\extracolsep{\fill}}l *{6}{S} @{} }
\toprule
& \multicolumn{2}{c}{(1) DSUE1} & \multicolumn{2}{c}{(2) DSUE2} & \multicolumn{2}{c}{(3) DSUE3} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
Variables & {Estimate} & {t-Values} & {Estimate} & {t-Values} & {Estimate} & {t-Values} \\
\addlinespace
\midrule
\addlinespace
\multicolumn{7}{@{}l}{\textbf{Panel A:} [0, 50] Buy-and-Hold CDS Return (in \%)} \\
\addlinespace
Intercept & -0.14\textsuperscript{***} & -2.86 & -0.14\textsuperscript{***} & -2.64 & -0.14\textsuperscript{***} & -2.85 \\
DSUE &  0.09 & 1.42 & 0.09 & 1.30 & 0.14 & 1.66 \\
BHAR & -3.56\textsuperscript{***} & -5.94 & -3.45\textsuperscript{***} & -5.76 & -3.53\textsuperscript{***} & -5.59 \\
$\Delta$VOLA & 7.45 & 0.39 & 10.99 & 0.55 & 0.55 & 0.04 \\
$\Delta$LEVERAGE & 0.86 & 1.52 & 1.04 & 1.64 & 0.97 & 1.40 \\
UPGRADE & 0.05 & 1.04 & 0.04 & 0.91 & 0.06 & 1.07 \\
DOWNGRADE & 0.04 & 0.73 & 0.03 & 0.71 & 0.02 & 0.40 \\
$\Delta$SPOT & -32.44 & -3.99 & -32.74\textsuperscript{***} & -4.03 &-31.92\textsuperscript{***} & -3.64 \\
$\Delta$SLOPE & 1.87 & -0.19 & -2.72 & -0.29 & -4.59 & -0.44 \\
Time dummies & {Yes} &  & {Yes} &  & {Yes} &  \\
N & 9,814 &  & 9,821 &  & 8,896 &  \\
Adj. R$^{2}$ & 0.168 &  & 0.160 &  & 0.161 & \\
\addlinespace
\midrule
\addlinespace
\multicolumn{7}{@{}l}{\textbf{Panel B:} [0, 50] Buy-and-Hold Equity Return } \\
\addlinespace
Intercept & 0.0069 & 1.39
 & 0.0060 & 1.23 & -0.0011 & -0.20 \\
DSUE & 0.0279 & 5.39 & 0.0289 & 6.21 & 0.0600 & 11.81 \\
Time Dummies & {Yes} & &  {Yes} & & {Yes} \\
N & 13,347 & & 13,365 & & 12,048 \\
Adj. R-squared & 0.0182 & &  0.0182 & & 0.0334 \\
\addlinespace
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[a] A subtable-specific footnote
\end{tablenotes}

\end{threeparttable}

\end{table}
\end{document} 

enter image description here

2
  • Dear Bernard, thank you for the code. The alignment is better, especially for the double digit numbers (e.g. 10.99). Still there is the wide space between the "top-table" notes? Do you know how to "shorten" this space?
    – eternity1
    Aug 14, 2014 at 22:10
  • I didn't even thoink one could use tablenotes above the table. Suppress singlespacing(it's automatic since threeparttable is a minpage) and \` at the end of the item, and replace with a vskip…`just after the ‘table headnotes’. See my updated answer, that demonstrates this.
    – Bernard
    Aug 14, 2014 at 22:34

You must log in to answer this question.

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