使用 threeparttable 和 tablenotes 时遇到一些问题

使用 threeparttable 和 tablenotes 时遇到一些问题

这是一个有效的例子:

\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}

我的代码产生这个输出(见图):

表格注释悬垂列宽示例

有什么想法可以让我阻止脚注悬垂在列上吗?

非常感激。

答案1

为了猜测表格的宽度,threeparttable必须“看到”tabular环境,但你将其隐藏在里面\resizebox

一般来说,不应该使用它\resizebox来使表格适合,因为这会造成字体大小不平衡。

该表的问题在于标题太宽:将其分成三行而不是两行。

\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}

在此处输入图片描述

答案2

在此处输入图片描述

\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}

相关内容