6

Here is a working example:

\documentclass[preprint, 12pt, 3p, twocolumn, sort&compress]{elsarticle}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{table}[]
\begin{threeparttable}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{@{}ccc@{}}
\toprule
\begin{tabular}[c]{@{}c@{}}Heating rate\\ (\si[per-mode=symbol]{\degreeCelsius\per\minute})\end{tabular} &
  \begin{tabular}[c]{@{}c@{}}Final temperature\\ (\si{\degreeCelsius})\end{tabular} &
  \begin{tabular}[c]{@{}c@{}}Carbonisation time\\ (\si{\minute})\end{tabular} \\ \midrule
1.4\tnote{$a$}  & 1000 & 708 \\
3.0  & 600  & 192 \\
3.0  & 800  & 258 \\
3.0  & 1000 & 325 \\
3.0  & 1200 & 392 \\
3.0  & 1400 & 458 \\
3.0  & 1600 & 525 \\
10.0 & 1000 & 98  \\
20.0 & 1000 & 49  \\
40.0 & 1000 & 24  \\ \bottomrule
\end{tabular}%
}
\begin{tablenotes}
    \footnotesize
    \item[$a$]{\SI[per-mode=symbol]{1}{\degreeCelsius\per\minute} to \SI{600}{\degreeCelsius} and then \SI[per-mode=symbol]{3}{\degreeCelsius\per\minute} to \SI{1000}{\degreeCelsius}}
\end{tablenotes}
\caption{Investigated carbonisation conditions \cite{bengtssonCarbonFibersLignin2020}}
\label{tab:conditions}
\end{threeparttable}
\end{table}


\end{document}

My code produces this output (see image):

Example of tablenote overhanging column width

Any idea how I might stop the footnote overhanging the column?

Much appreciated.

1
  • 1
    You shouldn't use \resizebox in general; in this particular case, threeparttable is not able to guess the table width.
    – egreg
    Apr 10, 2021 at 12:28

2 Answers 2

4

In order to guess the table width, threeparttable has to “see” the tabular environment, but you hide it inside \resizebox.

In general one should never use \resizebox to make a table fit, because this would create unbalances in font size.

The problem with this table are the wide headers: split them in three rows instead of two.

\documentclass[preprint, 12pt, 3p, twocolumn, sort&compress]{elsarticle}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{table}[htp]

\newcommand{\splitcell}[1]{{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}

\begin{threeparttable}

\begin{tabular*}{\columnwidth}{
  @{\extracolsep{\fill}}
  S[table-format=1.1]
  S[table-format=4.0]
  S[table-format=3.0]
  @{}
}
\toprule
\splitcell{Heating \\ rate \\ (\si[per-mode=symbol]{\degreeCelsius\per\minute})} &
\splitcell{Final \\ temperature \\ (\si{\degreeCelsius})} &
\splitcell{Carbonisation \\ time \\ (\si{\minute})} \\
\midrule
1.4\tnote{$a$}  & 1000 & 708 \\
 3.0 &  600 & 192 \\
 3.0 &  800 & 258 \\
 3.0 & 1000 & 325 \\
 3.0 & 1200 & 392 \\
 3.0 & 1400 & 458 \\
 3.0 & 1600 & 525 \\
10.0 & 1000 &  98 \\
20.0 & 1000 &  49 \\
40.0 & 1000 &  24 \\
\bottomrule
\end{tabular*}

\begin{tablenotes}
\footnotesize\raggedright
\item[$a$]{\SI[per-mode=symbol]{1}{\degreeCelsius\per\minute} to 
  \SI{600}{\degreeCelsius} and then \SI[per-mode=symbol]{3}{\degreeCelsius\per\minute} 
  to \SI{1000}{\degreeCelsius}}
\end{tablenotes}
\caption{Investigated carbonisation conditions \cite{bengtssonCarbonFibersLignin2020}}
\label{tab:conditions}
\end{threeparttable}
\end{table}

\end{document}

enter image description here

8
  • Hello, I've made all my tables fit using \resizebox in my document. Could you explain (perhaps using a very simple example) what I should be doing to make them fit in a column? Thank you for fixing my code for me here. Apr 10, 2021 at 12:51
  • 2
    @suckingalemon Look at your tables, then: their font size will probably be different from each other.
    – egreg
    Apr 10, 2021 at 13:09
  • 2
    @suckingalemon By not using \resizebox, but the tabular* method.
    – egreg
    Apr 10, 2021 at 13:16
  • 2
    @suckingalemon: Which approach to use in order to make a table fit into the available space depends on the specific table. My table doesn't fit; what are my options?, which includes a quite extensive list of approaches, might nevertheless be a useful place to start from.
    – leandriis
    Apr 10, 2021 at 13:17
  • 1
    @suckingalemon Break the long headers into manageable chunks.
    – egreg
    Apr 10, 2021 at 13:30
3

enter image description here

\documentclass[preprint, 12pt, 3p, twocolumn, sort&compress]{elsarticle}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{threeparttable}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\begin{document}

\begin{table}
\begin{threeparttable}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}S[table-format=2.1,table-space-text-post=\tnote{a}]S[table-format=4] S[table-format=3]@{}}
\toprule
{\thead{Heating rate\\ (\si[per-mode=symbol]{\degreeCelsius\per\minute})}} &
  {\thead{Final temp.\\ (\si{\degreeCelsius})}} &
  {\thead{Carbonisation\\ time (\si{\minute})}} \\ 
  \midrule
1.4\tnote{$a$}  & 1000 & 708 \\
3.0  & 600  & 192 \\
3.0  & 800  & 258 \\
3.0  & 1000 & 325 \\
3.0  & 1200 & 392 \\
3.0  & 1400 & 458 \\
3.0  & 1600 & 525 \\
10.0 & 1000 & 98  \\
20.0 & 1000 & 49  \\
40.0 & 1000 & 24  \\ \bottomrule
\end{tabular*}%
\begin{tablenotes}[flushleft]
    \footnotesize
    \item[$a$]{\SI[per-mode=symbol]{1}{\degreeCelsius\per\minute} to \SI{600}{\degreeCelsius} and then \SI[per-mode=symbol]{3}{\degreeCelsius\per\minute} to \SI{1000}{\degreeCelsius}}
\end{tablenotes}
\caption{Investigated carbonisation conditions \cite{bengtssonCarbonFibersLignin2020}}
\label{tab:conditions}
\end{threeparttable}
\end{table}

\end{document}

You must log in to answer this question.

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