如何實現從第一個表到第三個表的轉換,
其中主要涉及到兩點:
(1)底部腳注與表格自動對齊并縮進換行
(2)表格自適應頁面寬度
底部腳注的對齊與換行縮進需要用到
\usepackage{threeparttable}
\usepackage{booktabs}
表格自適應頁面寬度需要在合適位置添加如下命令:
\resizebox{\linewidth}{!}{
....
....
}
上述三個表格代碼如下:
\begin{table}[!ht]
\caption{This is a caption.}\label{tab:tablenotes}
\centering\begin{tabular}{*4{c}}\topruleModels & Metric1 & Metric2$^{2}$ & Metric3$^{2}$ \\ \midruleMethod1$^{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}}\topruleModels & Metric1 & Metric2\tnote{2} & Metric3\tnote{2} \\ \midruleMethod1\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}}\topruleModels & Metric1 & Metric2\tnote{2} & Metric3\tnote{2} \\ \midruleMethod1\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}