增加 threeparttable 中标题的宽度

增加 threeparttable 中标题的宽度

我想知道如何将环境中的标题宽度恢复threeparttable到常规table环境。标题在环境内很重要threeparttable。换句话说,我想增加标题宽度(图 1)。

在此处输入图片描述

最小工作示例如下:

\documentclass{article}
\usepackage{threeparttable,booktabs}

\begin{document}

\begin{table}
\centering
\begin{threeparttable}
\caption{This is example table with width equal to default width in table environment}
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

当我插入\renewcommand\TPTminimum{\linewidth}之前\caption{...}宽度有所延伸,但是表格保持左对齐(如下图2所示)。

图2

非常感谢任何建议或指点。

答案1

宏的\tnote定义方式使其在threeparttable环境之外无法发挥作用。这主要是为了防止它出现在 中\listoftables

\documentclass{article}
\usepackage{threeparttable,booktabs}

\begin{document}

\listoftables

\begin{table}
\let\TPToverlap=\TPTrlap
\centering
\caption{This is example table with width equal to default width in table 
  environment\tnote{1}}
\begin{threeparttable}
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

演示 1


如果您还希望音符更宽,您可以将tabular另一个放在里面tabular

\documentclass{article}
\usepackage{threeparttable,booktabs}

\newlength{\mymargin}

\begin{document}

\begin{table}
\begin{threeparttable}
\caption{This is example table with width equal to default width in table 
  environment\tnote{1}}
\begin{tabular}{@{}p{\textwidth}@{}}
\centering
\begin{tabular}{cccc}
\toprule
Col 1& Col 2 & Col 3 & Col 4 \\
\midrule
1 &  2 &  3 &  4 \\
5 &  6 &  7 &  8 \\
9 & 10 & 11 & 12 \\
\bottomrule
\end{tabular}
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\item[1] Long, long, long, long, long, long, note
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

演示 2

相关内容