当我使用多个表格或子表格并希望包含一个同时描述所有表格的表格注释时,表格注释仅为左侧表格创建,而不使用整个文本宽度。如何制作利用整个文本宽度的表格注释?
\documentclass[11pt,a4paper]{article}
\usepackage[flushleft]{threeparttable}
\usepackage{booktabs}
\usepackage{a4wide}
\begin{document}
\begin{table}[!htbp]
\begin{threeparttable}
\parbox{.553\linewidth}{
\centering
\caption{test1}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l r r r r r r }
\toprule
test & test & test & test & test & test & test \\
\midrule
test & 0 & 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}
}
\hfill
\parbox{.443\linewidth}{
\centering
\caption{test2}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l r r r }
\toprule
test & test & test & test \\
\midrule
test & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}
}
\begin{tablenotes}
\item{\textit{Notes:}} test test test test test test test test test test test test test test
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案1
无需使用 \parbox
:
\documentclass[11pt,a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage[flushleft]{threeparttable}
\usepackage{array, booktabs}
\begin{document}
\begin{table}[!htbp]
\begin{threeparttable}
\centering
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{p{0.54\textwidth}
@{\extracolsep{\fill}}
p{0.44\textwidth}}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l *{6}{r}}
\toprule
test & test & test & test & test & test & test \\
\midrule
test & 0 & 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}
&
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l *{3}{r}}
\toprule
test & test & test & test \\
\midrule
test & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}%
\end{tabular*}
\begin{tablenotes}
\item{\textit{Notes:}} test test test test test test test test test test test test test test
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
答案2
threeparttable 挂接到 tabular 中以获取宽度。因此,我认为一个合乎逻辑的方法是使用周围的 tabular:
\documentclass[11pt,a4paper]{article}
\usepackage[flushleft]{threeparttable}
\usepackage{booktabs}
\usepackage{a4wide}
\begin{document}
\begin{table}[!htbp]
\begin{threeparttable}
\begin{tabular}{@{}l@{}}
\parbox{.553\linewidth}{
\centering
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l r r r r r r }
\toprule
test & test & test & test & test & test & test \\
\midrule
test & 0 & 0 & 0 & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}
}
\hfill
\parbox{.443\linewidth}{
\centering
\setlength\tabcolsep{0pt}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l r r r }
\toprule
test & test & test & test \\
\midrule
test & 0 & 0 & 0 \\
\bottomrule
\end{tabular*}
}
\end{tabular}
\begin{tablenotes}
\item{\textit{Notes:}} test test test test test test test test test test test test test test
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}