# Threeparttable with figure, caption and footnotes as non-float

I have a one-page long threeparttable with a caption, a scheme on top (chemical reaction) and footnotes underneath. The table floats around freely, but I don't want it to float. When I use non-float environments though, threeparttable ceases to work. I am really happy with the layout, I just want it to stop floating. Is there a simple way without having to rewrite the entire set-up?

\begin{document}
\usepackage{tabularx}
\usepackage{threeparttable}
\begin{table}[h!]
\centering
\caption{Reaktionsoptimierung für die Silylierung von 4-Methylpyridin.}
%\replacecmpd[TMP1]{4-methylpyridin}
%\replacecmpd[TMP2]{triethylsilan}
%\replacecmpd[TMP3]{4-methylsilylpyridin}
%\replacecmpd[TMP4]{3-silyl-4-methylpyridin}
%\replacecmpd[TMP5]{4-disilylmethylpyridin}
%\replacecmpd[TMP6]{ru-acriphos.a}
\includegraphics[width=150mm]{100-Silylierung/Abbildungen/rgleichung-4-methylpyridin}
\begin{threeparttable}[h]
\begin{tabular}{ccp{8em}cccc}
\toprule
\# & Temp. [°C] & Bedingungen & Umsatz [\%]\tnote{1}&   & Ausbeute [\%]\tnote{1}    & \\
&   &   &   & a & b & c \\
\midrule
1    & 100   &    &  35   & 8     & 4     & 5      \\
2    & 130   &    &  50   & 23    & 4     & 6      \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Quantifizierung per GC-Messung, Verifizierung per $^1$H-NMR-Messung.
\end{tablenotes}
\end{threeparttable}
\label{tab:4-methylpyridin}
\end{table}
\end{document}


This is my mwe. Does anyone know an easy-to-implement-fix for this? Thanks very much! (please let me know, if there is more information needed or if I didn't set up the mwe as required.)

• Hi, Can you tell us why do you not want it to float? – Tobias Nov 6 '19 at 10:16
• What did you try to make your table non-float? If I use a minipage instead of table and \captionof{table}{...} form the caption package, the example works fine (provided that I add a documentclass, move the usepackage commands to the right place and add the missing packages). – leandriis Nov 6 '19 at 10:30
• General comment: You might probably want to onsider using tabularx to automatically make your table as wide as the textwidth (without having to specify the width of the third column manually). Depending on the length of the entries in the "Bedingungen" column, you might also want to introduce line breaks in the column headers to save some space (especially in column 2 and 4) Lastly, I'd also add \cmidrule{5-7} above a, b, c. – leandriis Nov 6 '19 at 10:32
• Hey Tobias, I want to make it stop floating, because it floats into another \section, three pages from where I want it to be placed, which I don't understand as I surround it by two full pages of only text, so there should be no reason to let it float so far away as the surrounding text is rather flexible. Thanks for the comment, leandriis, when I don't specify the lengths, I get linebreaks in the table, making it longer than a page, which I want to avoid. Generally, I do use tabularx already. Adding \cmidrule{5-7} looks better, thanks! – TheMaus Nov 6 '19 at 11:04
• I had tried using a minipage in combination with captionof, but it leads to multiple errors. My documentclass is scrbook and I am pretty sure I istalled all the necessary packages. @leandriis, would you mind posting your minipage example with used packages for me, so that I can check for missing features or mistakes in my set-up? – TheMaus Nov 6 '19 at 11:06

Your example works perfect on my system, provided you load necessary packages (and remove the offending degree character), see example 1. If you really want to get rid of the float, you remove the \table-environment, load the caption (or capt-of) package and use the \captionof-command to get caption. You should move the label inside the caption, see example 2. If you use KOMAscript, captionof is a build-in command:

Example 1

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tabularx, graphicx, booktabs}
\usepackage{threeparttable, lipsum}
\begin{document}

\lipsum[1]
\begin{table}[h!]
\centering
\caption{Reaktionsoptimierung für die Silylierung von 4-Methylpyridin.%
\label{tab:4-methylpyridin}}
%\replacecmpd[TMP1]{4-methylpyridin}
%\replacecmpd[TMP2]{triethylsilan}
%\replacecmpd[TMP3]{4-methylsilylpyridin}
%\replacecmpd[TMP4]{3-silyl-4-methylpyridin}
%\replacecmpd[TMP5]{4-disilylmethylpyridin}
%\replacecmpd[TMP6]{ru-acriphos.a}
\includegraphics[width=150mm]{100-Silylierung/Abbildungen/rgleichung-4-methylpyridin}
\begin{threeparttable}[h]
\begin{tabular}{ccp{8em}cccc}
\toprule
\# & Temp. [C] & Bedingungen & Umsatz [\%]\tnote{1}&   & Ausbeute [\%]\tnote{1}    & \\
&   &   &   & a & b & c \\
\midrule
1    & 100   &    &  35   & 8     & 4     & 5      \\
2    & 130   &    &  50   & 23    & 4     & 6      \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Quantifizierung per GC-Messung, Verifizierung per $^1$H-NMR-Messung.
\end{tablenotes}
\end{threeparttable}
\end{table}

\lipsum[2]

\end{document}


Example 2

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tabularx, graphicx, booktabs}
\usepackage{threeparttable, lipsum, caption}
\begin{document}

\lipsum[1]

\begin{center}
\captionof{table}{Reaktionsoptimierung für die Silylierung von Methylpyridin.%
\label{tab:4-methylpyridin}}
%\replacecmpd[TMP1]{4-methylpyridin}
%\replacecmpd[TMP2]{triethylsilan}
%\replacecmpd[TMP3]{4-methylsilylpyridin}
%\replacecmpd[TMP4]{3-silyl-4-methylpyridin}
%\replacecmpd[TMP5]{4-disilylmethylpyridin}
%\replacecmpd[TMP6]{ru-acriphos.a}
\includegraphics[width=\linewidth]{100-Silylierung/Abbildungen/rgleichung-4-methylpyridin}
\begin{threeparttable}[h]
\begin{tabular}{ccp{8em}cccc}
\toprule
\# & Temp. [C] & Bedingungen & Umsatz [\%]\tnote{1}&   & Ausbeute [\%]\tnote{1}    & \\
&   &   &   & a & b & c \\
\midrule
1    & 100   &    &  35   & 8     & 4     & 5      \\
2    & 130   &    &  50   & 23    & 4     & 6      \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item[1] Quantifizierung per GC-Messung, Verifizierung per $^1$H-NMR-Messung.
\end{tablenotes}
\end{threeparttable}
\end{center}

\lipsum[2]

\end{document}

• The center environment solved the problem! I had tried it before, but didn't set the label inside the captionof{table}{...\label{}}! Thank you so much for the super quick help! – TheMaus Nov 6 '19 at 11:13
• @TheMaus Since you use KOMAscript, you do not need the caption package. Use \captionaboveof{float type }[entry ]{title }, see page 132 in the (English) manual. – Sveinung Nov 6 '19 at 11:33

Here is a variant using tabularx and an X type column for the third column (ne need to manually determine the required column width). I have also used a combination of minipage and \captionof in order to make the table non floating and nevertheless add a cpation. I have also introduced linebreaks in the table headers as well as added a \cmidrule below "Ausbeute" and used a \multicolumn to center "Ausbeute" with respect to the last three columns. Like that, they will take up less space. Lastly, I have also introduced thesiunitx package to typeset units and to improve the alignment of numbers in the table:

\documentclass{scrreprt}
\usepackage[demo]{graphicx}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{booktabs}
\usepackage{makecell}

\usepackage{siunitx}

\begin{document}
\noindent
\begin{minipage}{\textwidth}
\centering
\captionof{table}{Reaktionsoptimierung für die Silylierung von 4-Methylpyridin.\label{tab:4-methylpyridin}}
%\replacecmpd[TMP1]{4-methylpyridin}
%\replacecmpd[TMP2]{triethylsilan}
%\replacecmpd[TMP3]{4-methylsilylpyridin}
%\replacecmpd[TMP4]{3-silyl-4-methylpyridin}
%\replacecmpd[TMP5]{4-disilylmethylpyridin}
%\replacecmpd[TMP6]{ru-acriphos.a}
\includegraphics[width=\textwidth]{100-Silylierung/Abbildungen/rgleichung-4-methylpyridin}
\begin{threeparttable}[h]
\begin{tabularx}{\textwidth}{cS[table-format=3]X*{4}{S[table-format=2]}}
\toprule
\# & {Temp.}  & Bedingungen & {Umsatz\tnote{1}}&   \multicolumn{3}{@{}c@{}}{Ausbeute [\%]\tnote{1}}    \\ \cmidrule{5-7}
& {[\si{\celsius}]}  &   &  [\%] & {a} & {b} & {c} \\
\midrule
1    & 100   &    &  35   & 8     & 4     & 5      \\
2    & 130   &    &  50   & 23    & 4     & 6      \\
\bottomrule
\end{tabularx}
\begin{tablenotes}\footnotesize
\item[1] Quantifizierung per GC-Messung, Verifizierung per $^1$H-NMR-Messung.
\end{tablenotes}
\end{threeparttable}
\end{minipage}
\end{document}
`