如何实现从第一个表到第三个表的转换,
其中主要涉及到两点:
(1)底部脚注与表格自动对齐并缩进换行
(2)表格自适应页面宽度
底部脚注的对齐与换行缩进需要用到
\usepackage{threeparttable}
\usepackage{booktabs}
表格自适应页面宽度需要在合适位置添加如下命令:
\resizebox{\linewidth}{!}{
....
....
}
上述三个表格代码如下:
\begin{table}[!ht]
\caption{This is a caption.}\label{tab:tablenotes}
\centering
\begin{tabular}{*4{c}}\toprule
Models & Metric1 & Metric2$^{2}$ & Metric3$^{2}$ \\ \midrule
Method1$^{1}$ & result & result & result \\
Method2$^{3}$ & result & result & result \\
Method3 & result & result & result \\
Method4 & result & result & result \\ \bottomrule
\end{tabular}
\begin{minipage}{\linewidth}
\raggedright
${ }^1$ Here to add text. Here to add text. Here to add text. Here to add text. Here to add text. Here to add text. \\
${ }^2$ Here to add text. Here to add text.\\
${ }^3$ Here to add text. Here to add text.
\end{minipage}
\end{table}
% 注意第一个表格的实现方式与下面两个并不相同
\begin{table}[!ht]
\caption{This is a caption.}\label{tab:tablenotes}
\centering
\begin{threeparttable}
\begin{tabular}{*4{c}}\toprule
Models & Metric1 & Metric2\tnote{2} & Metric3\tnote{2} \\ \midrule
Method1\tnote{1} & result & result & result \\
Method2\tnote{3} & result & result & result \\
Method3 & result & result & result \\
Method4 & result & result & result \\ \bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[1] Here to add text. Here to add text. Here to add text. Here to add text. Here to add text. Here to add text.
\item[2] Here to add text. Here to add text.
\item[3] Here to add text. Here to add text.
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{table}[!ht]
\caption{This is a caption.}\label{tab:tablenotes}
\centering
\resizebox{\linewidth}{!}{ % 注意这行所在的位置
\begin{threeparttable}
\begin{tabular}{*4{c}}\toprule
Models & Metric1 & Metric2\tnote{2} & Metric3\tnote{2} \\ \midrule
Method1\tnote{1} & result & result & result \\
Method2\tnote{3} & result & result & result \\
Method3 & result & result & result \\
Method4 & result & result & result \\ \bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[1] Here to add text. Here to add text. Here to add text. Here to add text. Here to add text. Here to add text.
\item[2] Here to add text. Here to add text.
\item[3] Here to add text. Here to add text.
\end{tablenotes}
\end{threeparttable}}
\end{table}