0

I try to center two subtables of which the second one has a tablenote to add which is why I am using a threeparttable. Unfortunately, I cannot get the second subtable centered on the page, it is always shifted to the left... what am I doing wrong here?

\documentclass[12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{multirow}

\begin{document}
\newlength{\myl}
\settowidth{\myl}{Suswasser (methylierte Verbindungen)}

\begin{table}[tbh]
\begin{threeparttable}
\centering
\caption[Short Caption]{Some Caption}
\label{tab:Label}
\begin{subtable}{\textwidth}\centering
\caption{Natürliche Systeme}
\begin{tabular}{p{\myl}l}
\toprule
\multirow{2}{*}{Umgebung} & Fraktionierungsfaktor (\(\varepsilon\))\\
& ...\\
\midrule
Süßwasser (methylierte Verbindungen) & 39 bis 58\\
Marin (Karbonatreduzierung) & 49 bis 95\\
\bottomrule
\end{tabular}
\end{subtable}

\begin{subtable}{\textwidth}\centering
\caption{Kulturexperimente}
\begin{tabular}{p{\myl}ll}
\toprule
\multirow{2}{*}{Substrat} & \multicolumn{2}{c}{Fraktionierungsfaktor (\(\varepsilon\))}\\
\cmidrule(l){2-3}
& A & B\\
\midrule
Methanol & 68 bis 77 & 40 bis 54\\
... & 24%\tnote{*}
bis 27 & 10\\
... & 39 & 49\\
... & 55 bis 58 & 55 bis 58\\
... & 44 bis 54 &\\
... & 49 &\\
... & 54 &\\
\bottomrule
\end{tabular}
\end{subtable}
 \begin{tablenotes}
    \item[*] ... fanden ... für Acetat.
    \end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
5
  • 1
    Actually it does, it is subtable which behaves strangely try wrapping the entire subtable in \fbox{...} you'll notice that the box is wider than the lines of the subtable. So the real question is why isn't the contents of the subtable centered inside the width given.
    – daleif
    Apr 9, 2020 at 12:22
  • 1
    Although aparently not directly related, threeparttable not working with subcaption(subtable), error: table inside subtable might nevertheless be interesting.
    – leandriis
    Apr 9, 2020 at 12:27
  • 2
    The threeparttable environment recognizes (unsurprisingly!) three parts: a caption (generally produced by \caption), a tabular-like environment (e.g, tabular, tabular*, and tabularx), and a tablenotes environment. Note what's not in the list of recognized parts: minipage environments. This matters because subtable and subfigure environments are minipage environments that have been told what to do if they encounter \caption statements.
    – Mico
    Apr 9, 2020 at 13:16
  • So it won't work... Is there an alternative to tablenotes? Apr 9, 2020 at 13:22
  • subcaption work inside talltblr defined in the tanularray package, which is is equivalent to threeparttable. See my answer below.
    – Zarko
    Apr 30, 2022 at 18:46

2 Answers 2

2

With use of the talltblr (defined in the tabularray package) your table can be set without nesting subtables in table:

\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, counter, varwidth}
\usepackage[skip=0pt, belowskip=0pt]{subcaption}

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%


\begin{document}
    \begin{table}[htb]
    \centering
    \begin{talltblr}[
caption = {Some Caption},
  entry = {Short Caption},
  label = {tab:Label},
note{*} = {... fanden ... für Acetat}
                    ]{colspec = {X[3,l] X[1,l] X[1,l]},
                      measure = vbox,
                      hspan=minimal
                     }
\SetRow{abovesep+=-6pt, belowsep+=-12pt}
\SetCell[c=3]{c}    \subcaption{Natürliche Systeme}
    &               &                       \\
    \toprule
\SetCell[r=2]{c}    Umgebung
    & \SetCell[c=2]{c}  Fraktionierungsfaktor ($\varepsilon$)
                    &                       \\
    &  ...          &                       \\
    \midrule
Süßwasser (methylierte Verbindungen)
    & 39 bis 58     &                       \\
Marin (Karbonatreduzierung)
    & 49 bis 95     &                       \\
    \midrule[1pt]
\SetRow{abovesep+=-6pt, belowsep+=-12pt}
\SetCell[c=3]{c}    \subcaption{Kulturexperimente}
    &                       &               \\
    \midrule[1pt]
\SetCell[r=2]{c}    Substrat
    &  \SetCell[c=2]{c}  Fraktionierungsfaktor (\(\varepsilon\))
                            &               \\
    \midrule
    &   A                   &   B           \\
    \midrule
Methanol
    & 66 bis 77             & 40 bis 54     \\
... & 24 bis 27\TblrNote{*} & 10            \\
... & 39                    & 49            \\
... & 55 bis 58             & 55 bis 58     \\
... & 44 bis 54             &               \\
... & 49                    &               \\
... & 54                    &               \\
    \bottomrule
\end{talltblr}
    \end{table}
\end{document}

enter image description here

(red lines indicate upper part of page layout)

0

Since Mico pointed out that the threeparttable doesn't recognize minipage environments, I looked for an alternative and found that

{\raggedright\footnotesize\centering My footnote \par}

will look the sames as the tablenotes.

1
  • 1
    \raggedright is superfluous.
    – Zarko
    Apr 9, 2020 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .