表格编号和标题单独居中

表格编号和标题单独居中

你好,我希望我的表头看起来像这样:

在此处输入图片描述

因此,表格计数位于顶部中央,标题后面跟着描述。

我的当前输出如下所示:

在此处输入图片描述

请注意,用阿拉伯数字计数表格是完全没问题的。此外,显示的粗体标题应该与表格列表中显示的标题不同,因为它太长了。

我的代码目前如下所示:

\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} 

谢谢!

答案1

我会为各种元素使用更好的标记。可以通过对格式以及和的定义进行操作来修改标题的布局\firstpart\secondpart我展示了如何使用后者来获得较小的字体大小)。

该表是数字的,因此最好以数学模式输入条目。

\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} 

注意。我删除了不必要的包并添加了showframe只是geometry为了在上下文中查看表格。

在此处输入图片描述

答案2

以下解决方案使用各种 LaTeX 包来实现您发布的既定目标(表格编号和主标题的单独居中)并修改表格材料本身的格式。

  • caption格式化标题的包;

  • tabularx用于设置表格材料宽度的包(\textwidth这可确保表格的图例不会占用太多的垂直空间);

  • siunitx包将所有数字条目(前四个数据行除外)与其各自的小数点标记对齐。

在此处输入图片描述

\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}

答案3

这是一个解决方案。我还加载了siunitx包,以便对小数点上的最后 4 列进行(部分)对齐:

\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} 

在此处输入图片描述

答案4

由于您已经在使用可选参数\caption,我只是将屏幕上的组件从\caption一起取出并将其放置在中\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} 

在此处输入图片描述

相关内容