2

I'm trying to take this MWE table and put it into a subcaption's subtable environment, or, alternatively, use subcaption's subcaption command - see subcaption's manual - to achieve the same end: to have that table twice next to each other.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[list=true]{subcaption}
%\usepackage[list=true]{subcaption}

\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}
\centering
\begin{threeparttable}
\caption{Some long boring caption don't fall asleep 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{table}

\end{document}

Inter alia I've tried this:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[list=true]{subcaption}
%\usepackage[list=true]{subcaption}

\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}

\begin{subtable}{.5\linewidth}
\centering
\begin{threeparttable}
\caption{Sub_caption A 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{subtable}


\begin{subtable}{.5\linewidth}
\centering
\begin{threeparttable}
\caption{Sub_caption B 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{subtable}

\caption{Some long boring caption don't fall asleep 2013}


\end{table}

\end{document}

and this

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[list=true]{subcaption}
%\usepackage[list=true]{subcaption}

\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}

\begin{minipage}{.5\linewidth}
\centering
\begin{threeparttable}
\subcaption{Sub_caption A 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{minipage}


\begin{minipage}{.5\linewidth}
\centering
\begin{threeparttable}
\subcaption{Sub_caption B 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{l}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{minipage}

\caption{Some long boring caption don't fall asleep 2013}


\end{table}

\end{document}

which both return the Package tabulary Warning: No suitable columns! on input line 31. error message. I could post additional failed attempts, but don't think that'd be helpful, would it?

Is there same mistake, or some incompatibility?

Note that I'd like to at least be able to apply the threeparttable with footnotes to all three tables: both the two subtables individually, as well as the "mother table" (whether in the end I'd combine the footnotes (or use any footnotes at all) is another matter...).

Futher, is subcaption capable of doing the list list-of-tables thing also of the subtables layed out neatly as in this subfig example here from here?

1

2 Answers 2

4

tabulary works by changing the width of L, C, R or J columns to achieve the requested total width. You have not supplied any such columns so it can do nothing except complain:

Package tabulary Warning: No suitable columns! 

This is unrelated to any table/subtable environment in which the construct is used.

Then you get $ errors because there is a _ in the caption and the tables come one above the other as they are in separate paragraphs.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabulary}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{caption}
\usepackage[list=true]{subcaption}
%\usepackage[list=true]{subcaption}

\renewcommand{\arraystretch}{1.2}
\sisetup{round-mode=places,round-precision=1, add-decimal-zero=true, add-integer-zero=true, round-integer-to-decimal}

\begin{document}

\begin{table}

\begin{subtable}{.5\linewidth}
\centering
\begin{threeparttable}
\caption{Sub\_caption A 2013}

\begin{tabulary}{\textwidth}{@{}*{1}{L}*{2}{c}@{}}
\toprule
%& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{subtable}%
\begin{subtable}{.5\linewidth}
\centering
\begin{threeparttable}
\caption{Sub\_caption B 2013}


\begin{tabulary}{\textwidth}{@{}*{1}{L}*{2}{S[table-format=3.2]}@{}}
\toprule
& {incl.\ Ingredients A\tnote{3}} & {excl.\ Ingredients A} \\
\midrule
DDDD & 36.1 & 22.0\\
EEEE & 30.9 & 20.0\\
\bottomrule
\end{tabulary}

\begin{tablenotes}
\item [2] Unweighted Average
\item [] Source: radiowaves from outer space 1999
\end{tablenotes}

\end{threeparttable}
\end{subtable}

\caption{Some long boring caption don't fall asleep 2013}


\end{table}

\end{document}
12
  • Somehow l lingered in my MWE; but that doesn't seem to be causing the error message; replacing it by L doesn't do the trick. Further, the first MWE above (with no sub-tables) just works. So even if the error message of MWE 2 and 3 seems to complain via/about tabulary I don't attribute the problem (directly) to tabulary. Apr 18, 2013 at 8:41
  • @nuttyaboutnatty see code in answer which produces no error messages Apr 18, 2013 at 8:46
  • 1
    You have an older version of expl3, I have Package: expl3 2013/03/14 v4469 L3 Experimental code bundle wrapper (and l3names similarly) which means I would guess you are hitting a weird siunitx incompatibility it's only siunitx that triggers l3 code in your MWE I think. Apr 18, 2013 at 9:14
  • 1
    It seems that threeparttable is incrementing main the table counter, even in subtable environments. Therefore the Table is titled Table 3 and not Table 1 as it should be. Futhermore both sub-tables are titled (a). I will take a look at this within the next days...
    – user2574
    Apr 19, 2013 at 5:35
  • 1
    sourceforge.net/p/latex-caption/tickets/8
    – user2574
    Apr 19, 2013 at 7:35
1

OK, so I finally got it working with subfig instead of subcaption.

Apparently, I'd need to install bleeding-edge LaTeX Kernel (thanks David Carlisle, Joseph Wright and Axel Sommerfeldt for noticing and looking into this !)

But after this whole shlep, I remembered the ideas expressed in the booktabs manual (and other common table-style-guides) and found a solution which avoids subfigs & subtables altogether: I "figured" that I'd end up with more lines than text (so-to-speak), and that there's a different way of constructing the table which will reduce the number of lines to the recommended three plus x (\toprule \middlerule \bottomrule and \cmidrule) which just looks SOOO much better.

Bottom line: in TeX there surely will be a way of cookin' up something fancily complicated (and potentially ugly): but simplicity often begets beauty.

You must log in to answer this question.

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