Longtable 标题不会在 threeparttable 环境中换行

Longtable 标题不会在 threeparttable 环境中换行

我正在使用该threeparttable包自动将标题换行到表格宽度。但是,我偶尔需要使用longtable它来将表格拆分到多个页面。当我这样做时,标题不再换行到表格的宽度,如下面的两个表格所示。我尝试包含该caption包并使用设置宽度,但\captionsetup{width=4cm}无济于事,但我宁愿使用自动解决方案,因为我有许多不同宽度的长表格。有没有 threeparttable 的修复或合适替代方案?(我有时确实需要\tnotethreeparttable 中的功能,但如果有必要,我可能会解决这个问题。)

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

\begin{document}
\begin{threeparttable}
\begin{tabular}{ll}
\caption{Caption for tabular does wrap inside threeparttable environment.}\\
\toprule
column1 & column2 \\
\midrule
info1 & info2\\
\bottomrule
\end{tabular}
\end{threeparttable}

\begin{threeparttable}
\begin{longtable}{ll}
\caption{Caption for longtable does not wrap inside threeparttable environment.}\\
\toprule
column1 & column2 \\
\midrule
info1 & info2\\
\bottomrule
\end{longtable}
\end{threeparttable}
\end{document}

在此处输入图片描述

相关内容