4

Hi I want my table header to look like this:

enter image description here

so with the table count centered on top and a header followed by a description.

My current output looks like this:

enter image description here

Please note that arabic number counting for tables is absolutely fine. Also the displayed bold header should be different from the one showing up in the list of tables, since it is too long.

My code currently looks as follows:

\documentclass[12pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{booktabs,rotating,dcolumn,caption}
\usepackage[margin=2cm,left=3.5cm,top=2.5cm,includefoot]{geometry}
\usepackage{threeparttable}
\begin{document}

\begin {table} [p]
\begin{threeparttable} 
\begin{center}
\caption[Sample Characteristics]{\\
\textbf{Descriptive Statistics for Sample Firms targeted by Hedge Funds and Comparison to Market Indices Members}\\
This table reports descriptive statistics of sample firms targeted by hedge funds and the respective averages for US equity indices. Reported are the average values with the respective median in braces. The average for the target sample is computed as the simple average of all available data for sample members as of their respective threshold dates. The average for indices is calculated as the simple average of all index member's average as of the beginning of 2006 and all index member's average as of the end of Q3/2014.}
\label{tab: samplecharacteristics}
\end{center}
\begin{tabular}{lrrrr}
\toprule
 Average & \multicolumn{1}{c}{Target} & \multicolumn{1}{c}{S\&P 500} & \multicolumn{1}{c}{Dow Jones} & CRSP US \\
 (Median) & \multicolumn{1}{c}{Sample} & & Industrial & Total Market \\
\midrule
\textbf{Size} \\
Market Cap. (in \$ mio.) & 2,264  & 30,844  & 140,556  & 5,803  \\
 & (662)  & (14,289)  & (121,225)  & (736)  \\
Total Assets (in \$1000) & 2,882  & 50,719  & 201,591  & 9,421  \\
 & (878)  & (12,523)  & (82,123)  & (886) \\
Price/Book Ratio & 3.8 & 4.6 & 4.0 & 5.6 \\
 & (2.2) & (3.1) & (3.6) & (2.2) \\
\textbf{Profitability} \\
Earnings per Share (in \$) & -1.22 & 10.45  & 2.09  & -157.46 \\
 & (0.14)  & (1.25)  & (1.77)  & (0.49)  \\
P/E Ratio & 42.5 & 26.0 & 17.0 & 48.1 \\
 & (19.6) & (19.3) & (17.4) & (19.6) \\
ROE & 4.3\% & 22.6\% & 23.3\% & 3.1\% \\
 & (7.2\%) & (16.1\%) & (21.0\%) & (9.9\%) \\
ROA & -0.7\% & 7.5\% & 8.7\% & -58.3\% \\
 & (3.2\%) & (6.6\%) & (8.2\%) & (3.0\%) \\
Dividend Yield & 17.8\% & 1.8\% & 2.3\% & 1.4\% \\
 & (1.8\%) & (1.4\%) & (2.3\%) & (0.1\%) \\
\textbf{Debt Capacity} \\
Total Debt to Assets & 24.0\% & 24.4\% & 23.2\% & 52.8\% \\
 & (18.2\%) & (22.5\%) & (20.6\%) & (16.2\%) \\
Leverage & 3.3 & 4.6 & 4.1 & 4.9 \\
 & (2.1) & (2.5) & (2.5) & (2.2) \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}


\end{document} 

Thanks!

2

I'd use a better markup for the various elements. The layout of the caption can be modified by acting on the format and also on the definitions of \firstpart and \secondpart (I showed how to use the latter for having smaller font size).

The table is numeric, so it's better to have the entries in math mode.

\documentclass[12pt, a4paper]{article}
\usepackage[margin=2cm,left=3.5cm,top=2.5cm,includefoot,showframe]{geometry}
\usepackage{booktabs,array,caption}
\usepackage{threeparttable}

\DeclareCaptionFormat{centerlabel}{{\centering #1\par}\medskip#3\par}
\captionsetup[table]{format=centerlabel}

\newcommand\firstpart[1]{{\centering\bfseries#1\par}\medskip}
\newcommand\secondpart[1]{\small#1}

\begin{document}

\begin{table}[p]
\centering
\begin{threeparttable} 

\caption[
  Descriptive Statistics for Sample Firms targeted by Hedge Funds
  and Comparison to Market Indices Members
]{%
  \firstpart{Descriptive Statistics for Sample Firms targeted by Hedge Funds
    and Comparison to Market Indices Members}
  \secondpart{This table reports descriptive statistics of sample firms targeted
   by hedge funds and the respective averages for US equity indices. Reported
   are the average values with the respective median in braces. The average
   for the target sample is computed as the simple average of all available
   data for sample members as of their respective threshold dates. The
   average for indices is calculated as the simple average of all index
   member's average as of the beginning of 2006 and all index member's
   average as of the end of Q3/2014.}
}\label{tab: samplecharacteristics}

\begin{tabular}{l *{4}{>{$}r<{$}}}
\toprule
Average & \multicolumn{1}{c}{Target} & \multicolumn{1}{c}{S\&P 500} &
  \multicolumn{1}{c}{Dow Jones} & \multicolumn{1}{c}{CRSP US} \\
(Median) & \multicolumn{1}{c}{Sample} & &
  \multicolumn{1}{c}{Industrial} & \multicolumn{1}{c}{Total Market} \\
\midrule
\textbf{Size} \\
Market Cap. (in \$ mio.) & 2,264  & 30,844  & 140,556  & 5,803  \\
 & (662)  & (14,289)  & (121,225)  & (736)  \\
Total Assets (in \$1000) & 2,882  & 50,719  & 201,591  & 9,421  \\
 & (878)  & (12,523)  & (82,123)  & (886) \\
Price/Book Ratio & 3.8 & 4.6 & 4.0 & 5.6 \\
 & (2.2) & (3.1) & (3.6) & (2.2) \\
\textbf{Profitability} \\
Earnings per Share (in \$) & -1.22 & 10.45  & 2.09  & -157.46 \\
 & (0.14)  & (1.25)  & (1.77)  & (0.49)  \\
P/E Ratio & 42.5 & 26.0 & 17.0 & 48.1 \\
 & (19.6) & (19.3) & (17.4) & (19.6) \\
ROE & 4.3\% & 22.6\% & 23.3\% & 3.1\% \\
 & (7.2\%) & (16.1\%) & (21.0\%) & (9.9\%) \\
ROA & -0.7\% & 7.5\% & 8.7\% & -58.3\% \\
 & (3.2\%) & (6.6\%) & (8.2\%) & (3.0\%) \\
Dividend Yield & 17.8\% & 1.8\% & 2.3\% & 1.4\% \\
 & (1.8\%) & (1.4\%) & (2.3\%) & (0.1\%) \\
\textbf{Debt Capacity} \\
Total Debt to Assets & 24.0\% & 24.4\% & 23.2\% & 52.8\% \\
 & (18.2\%) & (22.5\%) & (20.6\%) & (16.2\%) \\
Leverage & 3.3 & 4.6 & 4.1 & 4.9 \\
 & (2.1) & (2.5) & (2.5) & (2.2) \\
\bottomrule
\end{tabular}

\end{threeparttable}
\end{table}

\end{document} 

Note. I removed the unnecessary packages and added showframe to geometry just for seeing the table in context.

enter image description here

  • @Mico I didn't touch the table body. Another taboo. ;-) – egreg Dec 27 '14 at 1:31
  • thanks, @egreg. I tried to incorporate this into my document, I however get the following error message: ./00_TexFile_Master.tex253: LaTeX Error: There's no line here to end. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l. 253 \end{tabular} ? Any idea? thanks! – mt1111 Dec 27 '14 at 16:44
  • @marinko No, no idea. You probably have a stray \\. – egreg Dec 27 '14 at 16:45
  • Yeap, I removed the strays, in line 213 but I'm still getting, the l.253 \end{tabular} error :( – mt1111 Dec 27 '14 at 16:54
1

The following solution uses various LaTeX packages to achieve the stated objective of your posting (separate centering of table number and main caption) and to modify the formatting of the tabular material itself.

  • The caption package to format the caption;

  • the tabularx package to set the width of the tabular material to \textwidth (this assures that the table's legend doesn't end up taking up too much vertical space);

  • the siunitx package to align all numerical entries (except for the first four data rows) on their respective decimal markers.

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{booktabs,threeparttable}
\usepackage[margin=2cm,left=3.5cm,top=2.5cm,includefoot]{geometry}

\usepackage{caption}
\captionsetup{justification  = centering, 
              labelseparator = newline,
              textfont       = bf}

\usepackage{tabularx}  
\newcolumntype{C}{>{\centering\arraybackslash}X}  % centered version of "X" column type

\usepackage{siunitx}
\sisetup{table-format=-3.3, 
         input-open-uncertainty  = , 
         input-close-uncertainty = ,
         input-symbols = () }

\begin{document}

\begin{table}[p]
\begin{threeparttable}
\caption[Descriptive Statistics]{Descriptive Statistics for Sample Firms targeted by Hedge Funds and Comparison to Market Indices Members} \label{tab:samplecharacteristics}

\begin{tabularx}{\textwidth}{@{} l *{4}{S} @{}}
\multicolumn{5}{@{}p{\textwidth}@{}}{This table reports descriptive statistics of sample firms targeted by hedge funds and the respective averages for US equity indices. Reported are the average values with the respective median in parentheses. The average for the target sample is computed as the simple average of all available data for sample members as of their respective threshold dates. The average for indices is calculated as the simple average of all index members' average as of the beginning of 2006 and all index members' average as of the end of Q3/2014.}\\
\addlinespace
\toprule
& \multicolumn{1}{C}{Target Sample} 
& \multicolumn{1}{C}{S\&P 500} 
& \multicolumn{1}{C}{Dow Jones Industrial} 
& \multicolumn{1}{C@{}}{CRSP US Total Mkt} \\
\midrule
\textbf{Size} \\
Market Cap., in \$ mio. & {2,264} & {30,844} & {140,556} & {5,803} \\
& {(662)} & {(14,289)} & {(121,225)} & {(736)} \\[1ex]
Total Assets, in \$1,000 & {2,882} & {50,719} & {201,591} & {9,421} \\
& {(878)} & {(12,523)} & {(82,123)} & {(886)} \\[1ex]
Price/Book Ratio & 3.8 & 4.6 & 4.0 & 5.6 \\
& (2.2) & (3.1) & (3.6) & (2.2) \\
\addlinespace
\textbf{Profitability} \\
Earnings per Share, in \$ & -1.22 & 10.45 & 2.09 & -157.46 \\
& (0.14) & (1.25) & (1.77) & (0.49) \\[1ex]
P/E Ratio & 42.5 & 26.0 & 17.0 & 48.1 \\
& (19.6) & (19.3) & (17.4) & (19.6) \\[1ex]
ROE, in \% & 4.3 & 22.6 & 23.3 & 3.1 \\
& (7.2) & (16.1) & (21.0) & (9.9) \\[1ex]
ROA, in \% & -0.7 & 7.5 & 8.7 & -58.3 \\
& (3.2) & (6.6) & (8.2) & (3.0) \\[1ex]
Dividend Yield, in \% & 17.8 & 1.8 & 2.3 & 1.4 \\
& (1.8) & (1.4) & (2.3) & (0.1) \\
\addlinespace
\textbf{Debt Capacity} \\
Total Debt to Assets, in \% & 24.0 & 24.4 & 23.2 & 52.8 \\
 & (18.2) & (22.5) & (20.6) & (16.2) \\[1ex]
Leverage & 3.3 & 4.6 & 4.1 & 4.9 \\
& (2.1) & (2.5) & (2.5) & (2.2) \\
\bottomrule
\end{tabularx}
\end{threeparttable}
\end{table}

\end{document}
1

Here is a solution. I also loaded the siunitx package, to have a (partial) alignment of the last 4 columns on the decimal dot:

\documentclass[12pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{booktabs,rotating,dcolumn,caption, makecell}
\usepackage[margin=2cm,left=3.5cm,top=2.5cm,includefoot]{geometry}
\usepackage{threeparttable}
\usepackage{siunitx} %
\sisetup{table-format=-1.2, group-minimum-digits=4, group-separator={,}, table-number-alignment=center}
\DeclareCaptionLabelSeparator{break}{\\[2ex]}
\captionsetup{justification= centering, labelseparator = break}

\renewcommand\cellalign{lc}

\begin{document}

\begin {table} [p]
\begin{threeparttable}
  \caption[Sample Characteristics]{
    \textbf{Descriptive Statistics for Sample Firms targeted by Hedge Funds and Comparison to Market Indices Members}\\[3ex]
    \parbox{\linewidth}{This table reports descriptive statistics of sample firms targeted by hedge funds and the respective averages for US equity indices. Reported are the average values with the respective median in braces. The average for the target sample is computed as the simple average of all available data for sample members as of their respective threshold dates. The average for indices is calculated as the simple average of all index member's average as of the beginning of 2006 and all index member's average as of the end of Q3/2014.}}
  \label{tab: samplecharacteristics}
  \begin{tabular}{l*{4}{S}}
    \toprule
    \makecell{Average \\ (Median)} & {\thead{Target\\Sample}} & {\thead{S\&P 500}} & {\thead{Dow Jones\\ Industrial}} & {\thead{CRSP US\\Total Market}} \\
    \midrule
    \textbf{Size} \\
    Market Cap. (in \$\, mio.) & {2,264} & {30,844} & {140,556} & {5,803} \\
                                & {(662)} & {(14,289)} & {(121,225)} & {(736)} \\[1ex]
    Total Assets (in \$\,1,000) & {2,882} & {50,719} & {201,591} & {9,421} \\
                                & {(878)} & {(12,523)} & {(82,123)} & {(886)} \\[1ex]
    Price/Book Ratio & 3.8 & 4.6 & 4.0 & 5.6 \\
                                & {(2.2)} & {(3.1)} & {(3.6)} & {(2.2)} \\
    \addlinespace
    \textbf{Profitability} \\
    Earnings per Share (in \$) & -1.22 & 10.45 & 2.09 & -157.46 \\
                                & {(0.14)} & {(1.25)} & {(1.77)} & {(0.49)} \\[1ex]
    P/E Ratio & 42.5 & 26.0 & 17.0 & 48.1 \\
                                & {(19.6)} & {(19.3)} & {(17.4)} & {(19.6)} \\[1ex]
    ROE~(\%) & 4.3 & 22.6 & 23.3 & 3.1 \\
                                & {(7.2)} & {(16.1)} & {(21.0)} & {(9.9)} \\[1ex]
    ROA~(\%) & -0.7 & 7.5 & 8.7 & -58.3 \\
                                & {(3.2)} & {(6.6)} & {(8.2)} & {(3.0)} \\[1ex]
    Dividend Yield~(\%) & 17.8 & 1.8 & 2.3 & 1.4 \\
                                & {(1.8)} & {(1.4)} & {(2.3)} & {(0.1)} \\
    \addlinespace
    \textbf{Debt Capacity} \\
    Total Debt to Assets~(\%) & 24.0 & 24.4 & 23.2 & 52.8 \\
                                & {(18.2)} & {(22.5)} & {(20.6)} & {(16.2)} \\[1ex]
    Leverage & 3.3 & 4.6 & 4.1 & 4.9 \\
                                & {(2.1)} & {(2.5)} & {(2.5)} & {(2.2)} \\
    \bottomrule
  \end{tabular}
\end{threeparttable}
\end{table}

\end{document} 

enter image description here

0

Since you are already using the optional argument of \caption, I just took the on-screen component out of \caption altogether and placed it in a \parbox.

\documentclass[12pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{booktabs,rotating,dcolumn,caption}
\usepackage[margin=2cm,left=3.5cm,top=2.5cm,includefoot]{geometry}
\usepackage{threeparttable}
\begin{document}

\begin {table} [p]
%\begin{threeparttable} 
\centering
\caption[Sample Characteristics]{\label{tab: samplecharacteristics}}
\parbox{\textwidth}{{\centering\textbf{Descriptive Statistics for Sample Firms targeted by Hedge Funds and Comparison to Market Indices Members}\par\medskip}
This table reports descriptive statistics of sample firms targeted by hedge funds and the respective averages for US equity indices. Reported are the average values with the respective median in braces. The average for the target sample is computed as the simple average of all available data for sample members as of their respective threshold dates. The average for indices is calculated as the simple average of all index member's average as of the beginning of 2006 and all index member's average as of the end of Q3/2014.
\par\smallskip\centering\begin{tabular}{lrrrr}
\toprule
 Average & \multicolumn{1}{c}{Target} & \multicolumn{1}{c}{S\&P 500} & \multicolumn{1}{c}{Dow Jones} & CRSP US \\
 (Median) & \multicolumn{1}{c}{Sample} & & Industrial & Total Market \\
\midrule
\textbf{Size} \\
Market Cap. (in \$ mio.) & 2,264  & 30,844  & 140,556  & 5,803  \\
 & (662)  & (14,289)  & (121,225)  & (736)  \\
Total Assets (in \$1000) & 2,882  & 50,719  & 201,591  & 9,421  \\
 & (878)  & (12,523)  & (82,123)  & (886) \\
Price/Book Ratio & 3.8 & 4.6 & 4.0 & 5.6 \\
 & (2.2) & (3.1) & (3.6) & (2.2) \\
\textbf{Profitability} \\
Earnings per Share (in \$) & -1.22 & 10.45  & 2.09  & -157.46 \\
 & (0.14)  & (1.25)  & (1.77)  & (0.49)  \\
P/E Ratio & 42.5 & 26.0 & 17.0 & 48.1 \\
 & (19.6) & (19.3) & (17.4) & (19.6) \\
ROE & 4.3\% & 22.6\% & 23.3\% & 3.1\% \\
 & (7.2\%) & (16.1\%) & (21.0\%) & (9.9\%) \\
ROA & -0.7\% & 7.5\% & 8.7\% & -58.3\% \\
 & (3.2\%) & (6.6\%) & (8.2\%) & (3.0\%) \\
Dividend Yield & 17.8\% & 1.8\% & 2.3\% & 1.4\% \\
 & (1.8\%) & (1.4\%) & (2.3\%) & (0.1\%) \\
\textbf{Debt Capacity} \\
Total Debt to Assets & 24.0\% & 24.4\% & 23.2\% & 52.8\% \\
 & (18.2\%) & (22.5\%) & (20.6\%) & (16.2\%) \\
Leverage & 3.3 & 4.6 & 4.1 & 4.9 \\
 & (2.1) & (2.5) & (2.5) & (2.2) \\
\bottomrule
\end{tabular}}
%\end{threeparttable}
\end{table}
\end{document} 

enter image description here

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.