Longtable 在下一页有两个标题/标题

Longtable 在下一页有两个标题/标题

以下是一个演示:

\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage{longtable,booktabs}

  \setlength\LTpre{5em}
  \setlength\LTpost{5em}

\usepackage{caption}
\captionsetup{font={singlespacing,small}}
\captionsetup[table]{position=top,skip={0pt}}
\captionsetup[longtable]{skip=0pt}


\title{test}
\begin{document}
This is a test table.  % repeat the paragraph to make the table at the end of a page.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

This is a test table.

\begin{longtable}[]{@{}cl@{}}
\caption{test table test table test tabletest tabletest tabletest tabletest tabletest tabletest tabletest tabletest tabletest tabletest table}\tabularnewline
\toprule
col1 & col2\tabularnewline
\midrule
\endhead
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
1 & 2\tabularnewline
\bottomrule
\end{longtable}


End of the document.
\end{document}

表格从一页的末尾开始,但两个标题都转到下一页。查看输出

答案1

抱歉,这是一个错误,最简单的解决方法是

\clearpage

在桌子前。

相关内容