所有子表都有一个标题:正确排列列

所有子表都有一个标题:正确排列列

我正在尝试创建一个由其他三个子表组成的表。我尝试了两个版本(例如表格环境中的对齐问题)。有三个问题:1) 没有标题的子表的列被“移动”。2) 对于最后的子表,出现了较大的空间。3) 我想将第一个子表的标题放在标题之后(就像其他子表一样)。

1)带dcolumn的版本:

\begin{table}[ht!]
\setlength\tabcolsep{0.1pt}  % default value: 6.0pt
\caption{Post-Announcement Returns to Earnings Surprise Portfolios}
\label{tab:PortfolioReturns}

\begin{subtable}{\textwidth}
\caption*{\textbf{Panel A:} Portfolio Ranks formed according to SUE1} 
\label{tab:PortfolioSUE1}
\begin{tabular*}{\textwidth}%
  { @{\extracolsep{\fill}} l *{1}{d{4.0}} *{1}{d{2.5}} 
      *{2}{d{4.0}} *{2}{d{2.5}} @{} }
\toprule
 & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{mean} & \multicolumn{2}{c}{N} & \multicolumn{2}{c}{mean} \\
\cmidrule{4-5} \cmidrule{6-7}
Surprise Portfolio & \mc{N} & \mc{mean} & \mc{CASC} & \mc{BHAR} & \mc{CASC} & \multicolumn{1}{r@{}}{BHAR} \\
\midrule
1 & 1389 & -0.09759 & 1226 & 1350 & -0.00029 & -0.00566 \\
2 & 1348 & -0.01259 & 1181 & 1331 & 0.00065 & -0.00232 \\
3 & 1390 & -0.00447 & 1213 & 1367 & 0.00050 & -0.00404 \\
4 & 1376 & -0.00184 & 1164 & 1360 & 0.00009 & -0.00140 \\
5 & 1402 & 0.00046 & 1222 & 1383 & 0.00025 & 0.00189 \\
6 & 1331 & 0.00180 & 1175 & 1322 & 0.00025 & 0.00667 \\
7 & 1349 & 0.00368 & 1182 & 1333 & 0.00019 & 0.00675 \\
8 & 1327 & 0.00622 & 1193 & 1318 & 0.00031 & 0.00557 \\
9 & 1303 & 0.01191 & 1137 & 1283 & 0.00002 & 0.01829 \\
10 & 1335 & 0.08969 & 1183 & 1300 & -0.00044 & 0.03208 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & -0.00015 & 0.03774\\
\bottomrule
\end{tabular*}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\caption*{\textbf{Panel B:} Portfolio Ranks formed according to SUE2} 
\label{tab:PortfolioSUE2}
\begin{tabular*}{\textwidth}%
  { @{\extracolsep{\fill}} l *{1}{d{4.0}} *{1}{d{2.5}} 
      *{2}{d{4.0}} *{2}{d{2.5}} @{} }
1 & 1409 & -0.06690 & 1235 & 1372 & -0.00041 & -0.00714 \\
2 & 1324 & -0.01011 & 1164 & 1306 & 0.00086 & -0.00222 \\
3 & 1382 & -0.00383 & 1182 & 1363 & 0.00049 & -0.00555 \\
4 & 1419 & -0.00136 & 1207 & 1399 & 0.00014 & -0.00317 \\
5 & 1338 & 0.00063 & 1181 & 1324 & 0.00012 & 0.00219 \\
6 & 1370 & 0.00177 & 1223 & 1353 & 0.00024 & 0.01033 \\
7 & 1351 & 0.00323 & 1197 & 1336 & 0.00006 & 0.00835 \\
8 & 1329 & 0.00545 & 1180 & 1318 & 0.00015 & 0.00528 \\
9 & 1348 & 0.01014 & 1177 & 1331 & 0.00015 & 0.01316 \\
10 & 1300 & 0.06622 & 1140 & 1263 & 0.00002 & 0.03416 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & 0.00043 & 0.04130\\
\bottomrule
\end{tabular*}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\begin{threeparttable}
\caption*{\textbf{Panel C:} Portfolio Ranks formed according to SUE3} 
\label{tab:PortfolioSUE3}
\small
\begin{tabular*}{\textwidth}%
  { @{\extracolsep{\fill}} l *{1}{d{4.0}} *{1}{d{2.5}} 
      *{2}{d{4.0}} *{2}{d{2.5}} @{} }
1 & 1231 & -0.02934 & 1084 & 1213 & 0.00196 & -0.02531 \\
2 & 1232 & -0.00173 & 1052 & 1223 & 0.00043 & -0.01476 \\
3 & 1200 & -0.00032 & 1046 & 1196 & 0.00030 & -0.01422 \\
4 & 1252 & 0.00028 & 1110 & 1245 & 0.00030 & 0.00016 \\
5 & 1181 & 0.00058 & 1028 & 1177 & 0.00021 & 0.00516 \\
6 & 1220 & 0.00097 & 1060 & 1215 & 0.00007 & 0.00587 \\
7 & 1195 & 0.00152 & 1050 & 1186 & 0.00020 & 0.00998 \\
8 & 1193 & 0.00228 & 1046 & 1185 & -0.00037 & 0.02167 \\
9 & 1249 & 0.00386 & 1099 & 1246 & 0.00042 & 0.02336 \\
10 & 1171 & 0.01378 & 1065 & 1162 & -0.00089 & 0.04821 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & -0.00285 & 0.07352\\
\bottomrule
\end{tabular*}

\begin{tablenotes}
\item[a] A subtable-specific footnote
\end{tablenotes}

\end{threeparttable}
\end{subtable}

\end{table}

和 siunitx 版本:

\begin{table}[ht!]
\setlength\tabcolsep{0.1pt}  % default value: 6.0pt
\caption{Post-Announcement Returns to Earnings Surprise Portfolios}
\label{tab:PortfolioReturns}
\begin{subtable}{\textwidth}
\caption*{\textbf{Panel A:} Portfolio Ranks formed according to SUE1} 
\label{tab:PortfolioSUE1}

\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l 
  S[table-format=4.0]
  S[table-format=-1.5]
  *{2}{S[table-format=4.0]}
  *{2}{S[table-format=-1.5]}
  @{}
}
\toprule
 & & & \multicolumn{2}{c}{N} & \multicolumn{2}{c}{mean} \\
\cmidrule{4-5} \cmidrule{6-7}
Surprise Portfolio & {N} & {mean} & {CASC} & {BHAR} & {CASC} & {BHAR} \\
\midrule
1 & 1389 & -0.09759 & 1226 & 1350 & -0.00029 & -0.00566 \\
2 & 1348 & -0.01259 & 1181 & 1331 & 0.00065 & -0.00232 \\
3 & 1390 & -0.00447 & 1213 & 1367 & 0.00050 & -0.00404 \\
4 & 1376 & -0.00184 & 1164 & 1360 & 0.00009 & -0.00140 \\
5 & 1402 & 0.00046 & 1222 & 1383 & 0.00025 & 0.00189 \\
6 & 1331 & 0.00180 & 1175 & 1322 & 0.00025 & 0.00667 \\
7 & 1349 & 0.00368 & 1182 & 1333 & 0.00019 & 0.00675 \\
8 & 1327 & 0.00622 & 1193 & 1318 & 0.00031 & 0.00557 \\
9 & 1303 & 0.01191 & 1137 & 1283 & 0.00002 & 0.01829 \\
10 & 1335 & 0.08969 & 1183 & 1300 & -0.00044 & 0.03208 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & -0.00015 & 0.03774\\
\midrule
\end{tabular*}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\caption*{\textbf{Panel B:} Portfolio Ranks formed according to SUE2} 
\label{tab:PortfolioSUE2}
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l 
  S[table-format=4.0]
  S[table-format=-1.5]
  *{2}{S[table-format=4.0]}
  *{2}{S[table-format=-1.5]}
  @{}
}
1 & 1409 & -0.06690 & 1235 & 1372 & -0.00041 & -0.00714 \\
2 & 1324 & -0.01011 & 1164 & 1306 & 0.00086 & -0.00222 \\
3 & 1382 & -0.00383 & 1182 & 1363 & 0.00049 & -0.00555 \\
4 & 1419 & -0.00136 & 1207 & 1399 & 0.00014 & -0.00317 \\
5 & 1338 & 0.00063 & 1181 & 1324 & 0.00012 & 0.00219 \\
6 & 1370 & 0.00177 & 1223 & 1353 & 0.00024 & 0.01033 \\
7 & 1351 & 0.00323 & 1197 & 1336 & 0.00006 & 0.00835 \\
8 & 1329 & 0.00545 & 1180 & 1318 & 0.00015 & 0.00528 \\
9 & 1348 & 0.01014 & 1177 & 1331 & 0.00015 & 0.01316 \\
10 & 1300 & 0.06622 & 1140 & 1263 & 0.00002 & 0.03416 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & 0.00043 & 0.04130\\
\midrule
\end{tabular*}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\begin{threeparttable}
\caption*{\textbf{Panel C:} Portfolio Ranks formed according to SUE3} 
\label{tab:PortfolioSUE3}
\begin{tabular*}{\textwidth}{
  @{\extracolsep{\fill}}
  l 
  S[table-format=4.0]
  S[table-format=-1.5]
  *{2}{S[table-format=4.0]}
  *{2}{S[table-format=-1.5]}
  @{}
}
1 & 1231 & -0.02934 & 1084 & 1213 & 0.00196 & -0.02531 \\
2 & 1232 & -0.00173 & 1052 & 1223 & 0.00043 & -0.01476 \\
3 & 1200 & -0.00032 & 1046 & 1196 & 0.00030 & -0.01422 \\
4 & 1252 & 0.00028 & 1110 & 1245 & 0.00030 & 0.00016 \\
5 & 1181 & 0.00058 & 1028 & 1177 & 0.00021 & 0.00516 \\
6 & 1220 & 0.00097 & 1060 & 1215 & 0.00007 & 0.00587 \\
7 & 1195 & 0.00152 & 1050 & 1186 & 0.00020 & 0.00998 \\
8 & 1193 & 0.00228 & 1046 & 1185 & -0.00037 & 0.02167 \\
9 & 1249 & 0.00386 & 1099 & 1246 & 0.00042 & 0.02336 \\
10 & 1171 & 0.01378 & 1065 & 1162 & -0.00089 & 0.04821 \\
\multicolumn{5}{l}{Hedge return (Portfolio 10 - Portfolio 1)} & -0.00285 & 0.07352\\
\bottomrule
\end{tabular*}

\begin{tablenotes}
\item[a] A subtable-specific footnote
\end{tablenotes}

\end{threeparttable}
\end{subtable}

\end{table}

两个版本的结果是一样的。非常感谢。

答案1

除非我遗漏了什么重要的东西,否则我认为没有必要为手头的事情创建三个独立的tabular*环境,每个环境都包含在一个subtable环境中。如果你真的需要确保三个子部分的列宽一致,那么迄今为止最简单的方法是创建只有一个 tabular*(或tabular,或任何其他)环境。失去分别交叉引用三个子部分的灵活性是值得的。

顺便说一句,如果d{4.0}每列仅包含由四位数字组成的数字,则可以通过为c相关列指定普通列类型来简化操作。另外,由于三个面板刚好适合单个页面,因此将它们嵌入到环境中可能毫无意义threeparttable

在此处输入图片描述

\documentclass[12pt,a4paper]{article}
\usepackage[left=4cm, right=3cm, top=3cm, bottom=4cm]{geometry} 
\usepackage{booktabs} % \toprule, \midrule, etc 
\usepackage[labelsep=newline,% line break after label
   justification=raggedright,
   singlelinecheck=off]{caption}
\usepackage{dcolumn} % decimal point alignment
\newcolumntype{d}[1]{D{.}{.}{#1}}

\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\begin{document}
\begin{table}[ht!]
\setlength\tabcolsep{0.1pt}  % default value: 6.0pt
\caption{Post-Announcement Returns to Earnings Surprise Portfolios}
\label{tab:PortfolioReturns}

\begin{tabular*}{\textwidth}%
  { @{\extracolsep{\fill}} l c d{2.5} cc *{2}{d{2.5}} }
\toprule
Surprise Portfolio  & N & \multicolumn{1}{c}{mean} & \multicolumn{2}{c}{N} & \multicolumn{2}{c}{mean} \\
\cmidrule{4-5} \cmidrule{6-7}
& & & CASC & BHAR & \mc{CASC} & \mc{BHAR} \\
\midrule
\multicolumn{7}{l}{Panel A: Portfolio Ranks formed according to SUE1} \\[0.5ex]
1 & 1389 & -0.09759 & 1226 & 1350 & -0.00029 & -0.00566 \\
2 & 1348 & -0.01259 & 1181 & 1331 & 0.00065 & -0.00232 \\
3 & 1390 & -0.00447 & 1213 & 1367 & 0.00050 & -0.00404 \\
4 & 1376 & -0.00184 & 1164 & 1360 & 0.00009 & -0.00140 \\
5 & 1402 & 0.00046 & 1222 & 1383 & 0.00025 & 0.00189 \\
6 & 1331 & 0.00180 & 1175 & 1322 & 0.00025 & 0.00667 \\
7 & 1349 & 0.00368 & 1182 & 1333 & 0.00019 & 0.00675 \\
8 & 1327 & 0.00622 & 1193 & 1318 & 0.00031 & 0.00557 \\
9 & 1303 & 0.01191 & 1137 & 1283 & 0.00002 & 0.01829 \\
10 & 1335 & 0.08969 & 1183 & 1300 & -0.00044 & 0.03208 \\[0.5ex]
\multicolumn{5}{l}{Hedge return (Portfolio 10 $-$ Portfolio 1)} & -0.00015 & 0.03774\\
\midrule
\multicolumn{7}{l}{Panel B: Portfolio Ranks formed according to SUE2} \\[0.5ex]
1 & 1409 & -0.06690 & 1235 & 1372 & -0.00041 & -0.00714 \\
2 & 1324 & -0.01011 & 1164 & 1306 & 0.00086 & -0.00222 \\
3 & 1382 & -0.00383 & 1182 & 1363 & 0.00049 & -0.00555 \\
4 & 1419 & -0.00136 & 1207 & 1399 & 0.00014 & -0.00317 \\
5 & 1338 & 0.00063 & 1181 & 1324 & 0.00012 & 0.00219 \\
6 & 1370 & 0.00177 & 1223 & 1353 & 0.00024 & 0.01033 \\
7 & 1351 & 0.00323 & 1197 & 1336 & 0.00006 & 0.00835 \\
8 & 1329 & 0.00545 & 1180 & 1318 & 0.00015 & 0.00528 \\
9 & 1348 & 0.01014 & 1177 & 1331 & 0.00015 & 0.01316 \\
10 & 1300 & 0.06622 & 1140 & 1263 & 0.00002 & 0.03416 \\[0.5ex]
\multicolumn{5}{l}{Hedge return (Portfolio 10 $-$ Portfolio 1)} & 0.00043 & 0.04130\\
\midrule
\multicolumn{7}{l}{Panel C: Portfolio Ranks formed according to SUE3} \\[0.5ex]
1 & 1231 & -0.02934 & 1084 & 1213 & 0.00196 & -0.02531 \\
2 & 1232 & -0.00173 & 1052 & 1223 & 0.00043 & -0.01476 \\
3 & 1200 & -0.00032 & 1046 & 1196 & 0.00030 & -0.01422 \\
4 & 1252 & 0.00028 & 1110 & 1245 & 0.00030 & 0.00016 \\
5 & 1181 & 0.00058 & 1028 & 1177 & 0.00021 & 0.00516 \\
6 & 1220 & 0.00097 & 1060 & 1215 & 0.00007 & 0.00587 \\
7 & 1195 & 0.00152 & 1050 & 1186 & 0.00020 & 0.00998 \\
8 & 1193 & 0.00228 & 1046 & 1185 & -0.00037 & 0.02167 \\
9 & 1249 & 0.00386 & 1099 & 1246 & 0.00042 & 0.02336 \\
10 & 1171 & 0.01378 & 1065 & 1162 & -0.00089 & 0.04821 \\[0.5ex]
\multicolumn{5}{l}{Hedge return (Portfolio 10 $-$ Portfolio 1)} & -0.00285 & 0.07352\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}

相关内容