I am trying to implement a table with several subtable
s, but working with subcaption
does not work neither when I try tabularx
. This subtables
have different number of columns. with the following code the tables are not equal in width.
\begin{table}[ht]
\caption{Earnings Surprise and Cumulated Returns}
\resizebox{\textwidth}{!}{\begin{threeparttable}
\begin{tabular}{@{\extracolsep{4pt}}lcccccccccc@{}}
\hline\hline
& \multicolumn{3}{c}{N} & \multicolumn{3}{c}{mean} & \multicolumn{2}{c}{N} & \multicolumn{2}{c}{mean} \\
\cline{2-4} \cline{5-7} \cline{8-9} \cline{10-11}
& SUE1 & SUE2 & SUE3 & SUE1 & SUE2 & SUE3 & CASC & BHAR & CASC & BHAR \\ [1ex]
\hline
AAA & 731 & 731 & 613 & 0.0004 & 0.0004 & 0.0104 & 688 & 726 & 0.0002 & -0.0084 \\
A & 3865 & 3865 & 3455 & -0.0013 & -0.0007 & 0.0002 & 3424 & 3827 & 0.0003 & 0.0027 \\
BBB & 6308 & 6313 & 5711 & -0.0017 & -0.0009 & 0.0000 & 5512 & 6252 & 0.0003 & 0.0060 \\
NIG & 3166 & 3172 & 2825 & 0.0006 & 0.0019 & -0.0054 & 2685 & 3080 & 0.0000 & 0.0148 \\ [1ex]
All & 14070 & 14081 & 12604 & -0.0010 & -0.0001 & -0.0007 & 12309 & 13885 & 0.0002 & 0.0063 \\ [1ex]
Investment-Grade & 10904 & 10909 & 9779 & -0.0014 & -0.0007 & 0.0007 & 9624 & 10805 & 0.0003 & 0.0039 \\
Speculative-Grade & 3166 & 3172 & 2825 & 0.0006 & 0.0019 & -0.0054 & 2685 & 3080 & 0.0000 & 0.0148 \\ [1ex]
\hline
\end{tabular}
\bigskip
\begin{tabular}{@{\extracolsep{4pt}}lcccccccccc@{}}
\hline\hline
& \multicolumn{3}{c}{N} & \multicolumn{3}{c}{mean} & \multicolumn{2}{c}{N} & \multicolumn{2}{c}{mean} \\
\cline{2-4} \cline{5-7} \cline{8-9} \cline{10-11}
& SUE1 & SUE2 & SUE3 & SUE1 & SUE2 & SUE3 & CASC & BHAR & CASC & BHAR \\ [1ex]
\hline
2004 & 1747 & 1748 & 1487 & 0.0023 & 0.0031 & 0.0006 & 1342 & 1741 & -0.0003 & 0.0214 \\
2005 & 1727 & 1728 & 1513 & 0.0022 & 0.0009 & 0.0006 & 1420 & 1707 & -0.0002 & 0.0066 \\
2006 & 1646 & 1648 & 1473 & 0.0002 & 0.0015 & 0.0011 & 1431 & 1624 & 0.0002 & 0.0045 \\
2007 & 1594 & 1595 & 1427 & -0.0085 & -0.0075 & -0.0039 & 1329 & 1573 & 0.0014 & -0.0136 \\
2008 & 1545 & 1545 & 1414 & -0.0303 & -0.0163 & -0.0172 & 1429 & 1527 & 0.0042 & 0.0132 \\
2009 & 1492 & 1494 & 1384 & 0.0163 & 0.0064 & 0.0011 & 1400 & 1482 & -0.0049 & 0.0297 \\
2010 & 1471 & 1473 & 1357 & 0.0115 & 0.0112 & 0.0037 & 1332 & 1458 & 0.0005 & -0.0042 \\
2011 & 1445 & 1445 & 1303 & 0.0056 & 0.0059 & 0.0048 & 1326 & 1417 & 0.0024 & -0.0108 \\
2012 & 1403 & 1405 & 1246 & -0.0076 & -0.0062 & 0.0040 & 1300 & 1356 & -0.0010 & 0.0079 \\ [1ex]
All & 14070 & 14081 & 12604 & -0.0010 & -0.0001 & -0.0007 & 12309 & 13885 & 0.0002 & 0.0063 \\[1ex]
pre-crisis & 5120 & 5124 & 4473 & 0.0016 & 0.0019 & 0.0008 & 4193 & 5072 & -0.0001 & 0.0110 \\
crisis & 3139 & 3140 & 2841 & -0.0193 & -0.0118 & -0.0105 & 2758 & 3100 & 0.0028 & -0.0004 \\
post-crisis & 5811 & 5817 & 5290 & 0.0066 & 0.0044 & 0.0034 & 5358 & 5713 & -0.0008 & 0.0058 \\ [1ex]
\hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item This is where authors provide additional information about the data, including whatever notes are needed.
asdfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
asdfasdfsfffffffffffffffffffffffffffffffffffffffffffff
asdffffffffffffffffffffffffffffffffffffffffffffffffff
asdfffffffffffffffffffffffffffffffffffffffffffffffffffff
asdffffffffffffffffffffffffffffffffffffffffffffffffffffff
asdfffffffffffffffffffffffffffffffffffffffffffffffffffffff
asdfffffffffffffffffffffffffffffffffffffffffffffffd
asdfaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
asdfasdfsfffffffffffffffffffffffffffffffffffffffffffff
asdffffffffffffffffffffffffffffffffffffffffffffffffff
asdfffffffffffffffffffffffffffffffffffffffffffffffffffff
asdffffffffffffffffffffffffffffffffffffffffffffffffffffff
asdfffffffffffffffffffffffffffffffffffffffffffffffffffffff
asdffffffffffffffffffffffffffffffffffffffffffffff
\end{tablenotes}
\end{threeparttable}}
\end{table}
Moreover, is generally possible to set the table such that the use the maximum allowed size? In other words, they take the whole space no matter whether necessary or not.
Another question is: With the present caption I get "Table 1: xyz". Would it be possible to turn it into:
TABLE 1 \ \
xyz
Best Answer
You could use a
tabular*
environment, as is done in the table below, to force the tabular material to take up the full width of the text block. By setting\tabcolsep
(the parameter that governs the default amount of inter-column whitespace) to a very small value and providing additional, flexible whitespace via an@{\extracolsep{\fill}}
directive, thetabular*
environment will take up exactly the assigned width (usually,\textwidth
).I further suggest you use the
dcolumn
package and its tools to align the numerical data columns on their decimal points. Doing so will also make LaTeX use typographically correct "minus" symbols instead of text-mode dashes whenever a-
is encountered.To get a line break between "Table 1" and the caption, use the tools of the
caption
package (see the code below for the exact tools deployed).I suggest you also use the
subcaption
package and assign each of the two tabulars to a separatesubtable
environment. That way, you can assign a caption to each subtable and cross-reference the subtables individually, as needed. Subcaptions are very helpful as "signposts" for your readers.If you need the tools of the
threeparttable
environment, note that it's possible to have embed athreeparttable
environment within asubtable
environment.A final suggestion: Don't use the basic but not-so-capable
\hline
directive to draw horizontal lines. Instead, consider using the much more sophisticated macros of thebooktabs
package:\toprule
,\midrule
,\bottomrule
, and\cmidrule
. You'll find that macros provide much better spacing around the horizontal lines.Just for the comparison, here's how the table looks like when using your original code (which also requires loading the
graphicx
package, not loaded in the code above). Proceeding more or less from top to bottom, some of the main differences relative to the look above are: table caption is centered and on a single line; no (sub)captions for the two subtables; very tight spacing (too tight, really) between\hline
s and material in the following row; very little space --4pt
, to be exact -- between the\cline
instructions; the numbers in the data columns are centered rather than aligned on their decimal points, and the occasion minus signs are rendered improperly as simple dashes; the twotabular
environments have different widths.