我已调整了 latex 表格的大小,以便将其放入两列文档中,如下面的代码所示。之后,表格注释似乎被移到了左侧。我希望表格注释与表格的左侧和右侧对齐。
\documentclass[layout=twocolumn]{article}
\usepackage[version=3]{mhchem}
\usepackage{threeparttable}
\begin{document}
\begin{table}[htb]
\caption{My data}{\label{T:Table1}}
\begin{threeparttable}
\footnotesize \resizebox{\columnwidth}{!}{%\centering
\begin{tabular}{l l lll }
\hline
test1 &test2 & test3 &test4& test5 \\
\hline\hline
AA & 1 & 2 & 3 & 4 \\
\hline\hline
\end{tabular}}
\begin{tablenotes}[para]
\footnotesize
\item I want to set the right side margin to the end of the table. The item is flushedto left side of thetable
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案1
为什么不使用tabularx
。要使用,resizebox
您还需要包括threeparttable
环境。见下文。
\documentclass[layout=twocolumn]{article}
\usepackage[version=3]{mhchem}
\usepackage{threeparttable}
\usepackage{tabularx}
\begin{document}
\begin{table}[htb]
\caption{My data}{\label{T:Table1}}
\resizebox{\columnwidth}{!}{%
\begin{threeparttable}
\begin{tabular}{l l lll }
\hline
test1 &test2 & test3 &test4& test5 \\
\hline\hline
AA & 1 & 2 & 3 & 4 \\
\hline\hline
\end{tabular}
\begin{tablenotes}[para]
\footnotesize
\item I want to set the right side margin to the end of the table. The item is flushedto left side of thetable
\end{tablenotes}
\end{threeparttable}}
\end{table}
\begin{table}[htb]
\caption{My data}{\label{T:Table2}}
\begin{threeparttable}
\begin{tabularx}{\columnwidth}{X l lll }
\hline
test1 &test2 & test3 &test4& test5 \\
\hline\hline
AA & 1 & 2 & 3 & 4 \\
\hline\hline
\end{tabularx}
\begin{tablenotes}[para]
\footnotesize
\item I want to set the right side margin to the end of the table. The item is flushedto left side of thetable
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}