How can I add a heading paragraph below the title and before the toprule on the table below? When I use \multicolumn and add a paragraph, it doesn't seem to work. I used \table and \tabular before and could put the paragraph before the \tabular command, but I now need to use a longtable as I'm aligning decimals with siunitx, so I can't put the table in a box.
How can I fit the table into the page width below and specify column widths to improve the layout? I would like to equally space out the AAA, BBB, CCC, DDD columns, but have a space between the four groups to make it easier to read.
When I use the \footnotesize macro, it affects the title and the paragraph of text also, does it? Also, the size of the text in the last paragraph seems to be reduced due to the \footnotesize macro.
\documentclass[oneside,12pt]{article}
%tables
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{siunitx} %align numbers by decimal point
\usepackage{lipsum}
\begin{document}
\sisetup{table-format = -1.2}
\setlength{\tabcolsep}{2pt}
\lipsum[1]
\footnotesize{
\begin{longtable}{
l
S[table-format = <1.3]
S[table-format = <1.3]
S[table-format = <1.3]@{\hskip 0.2cm}
S[table-format = <1.3]
S[table-format = <1.3]
S[table-format = <1.3] @{\hskip 0.2cm}
S[table-format = <1.3]
S[table-format = <1.3]
S[table-format = <1.3]@{\hskip 0.2cm}
S[table-format = <1.3]
S[table-format = <1.3]
S[table-format = <1.3]}
\caption[Table title]{Table title} \label{treeSummary} \\
\multicolumn{13}{s}{\lipsum[1]} \\
\toprule
& \multicolumn{6}{c}{First Group} & \multicolumn{6}{c}{Second Group} \\
& \multicolumn{3}{c}{AB} & \multicolumn{3}{c}{CD} & \multicolumn{3}{c}{EF} & \multicolumn{3}{c}{GH}\\
\midrule
& \multicolumn{1}{c}{AAA} & \multicolumn{1}{c}{AAA} & \multicolumn{1}{c}{AAA} & \multicolumn{1}{c}{BBB} & \multicolumn{1}{c}{BBB} & \multicolumn{1}{c}{BBB} & \multicolumn{1}{c}{CCC} & \multicolumn{1}{c}{CCC} & \multicolumn{1}{c}{CCC} & \multicolumn{1}{c}{DDD} & \multicolumn{1}{c}{DDD} & \multicolumn{1}{c}{DDD} \\
One & 2.72 & 1.11 & 0.163 & 1.03 & 1.70 & 0.087 & 0.18 & 0.11 & {$<$}0.001 & 0.47 & 1.14 & 0.063 \\
Two & 1.65 & 2.62 & 0.084 & 1.37 & 1.38 & 0.095 & 0.11 & 0.14 & 0.124 & 0.54 & 0.58 & 0.174 \\
Three & 2.39 & 1.57 & 0.331 & 1.77 & 1.95 & 0.007 & 0.83 & 0.24 & {$<$}0.001 & 1.18 & 1.07 & 0.004 \\
Four & 1.05 & {--} & {--} & 2.72 & 2.99 & 0.144 & 0.07 & {--} & {--} & 1.67 & 1.40 & {$<$}0.009 \\
\noalign{\vskip 5pt}
Sum & 0.660 & 0.004 & & {$<$}0.001 & 0.245 & & {$<$}0.001 & {$<$}0.001 & & {$<$}0.001 & 0.010 & \\
\bottomrule
\end{longtable}
}
\lipsum[1]
\end{document}
longtable
?siunitx
can be used withoutlongtable
too. At present your table is too wide and usinglongtable
will impose restrictions to resize it.