I haven't been able to figure out the best way to set up my tables. These are the features that they are supposed to have:
- Should be centered on page
- Caption should be "justified" and aligned with left border of the table. If caption spans over two line, then line should break at right border of the table.
- Additional comments should stand between caption and top border of table, and should as well be "justified" and aligned with left border of the table. If the additional comments contain a second line, it should break at the right border of the table.
To clarify I included two examples in the following code. The first is exactly what my tables are supposed to look like. It works only, because the table is so wide, that there are no other possibilities for alignments and line breaks. The second table just does not follow rule #2 and #3 as stated above. Does anyone have an idea how to solve these two problems?
Thanks a lot.
\documentclass[captions=tableheading]{scrbook}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage[figuresright]{rotating}
\usepackage[format=hang,justification=justified,singlelinecheck=false]{caption}[2004/07/16]
\usepackage{blindtext}
\usepackage{pdflscape}
\newcommand{\commenttable}[1]{\par{\itshape #1\par}\vskip 2mm}
\begin{document}
\begin{landscape}
\begin{table}
\caption{A table caption with a really fancy and ridiculously long description of what could and also should be said in just a few words}
\commenttable{Hello. \blindtext.}
\centering
\begin{tabular}{SSSSSSSSSSSSS}
\toprule
{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}\\
\midrule
12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34&12.34&12.34 \\
12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34&12.34&12.34 \\
\bottomrule
\end{tabular}
\end{table}
\end{landscape}
\begin{landscape}
\begin{table}
\caption{A table caption with a really fancy and ridiculously long description of what could and also should be said in just a few words}
\commenttable{Hello. \blindtext.}
\centering
\begin{tabular}{SSSSSSSSSS}
\toprule
{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}&{column}\\
\midrule
12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 \\
12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 &12.34 \\
\bottomrule
\end{tabular}
\end{table}
\end{landscape}
\end{document}
Best Answer
Here is a solution that uses the
caption
and thefloatrow
packages. Yourcommenttable
command has to be put in the first argument of thettabbox
command, just aftercaption{…}
. To have a correct vertical spacing, I had to modify it slighly.