有没有办法不让分页符切断大表格?

有没有办法不让分页符切断大表格?

假设我有一个比页面还大的表格,我该如何做才能使第二页显示上一页的标题,并且不会将一行分成两半。类似于 CSS 的内容:

thead { display: table-header-group }
tfoot { display: table-row-group }
tr { page-break-inside: avoid }

答案1

示意图:

\documentclass{article}
\usepackage{longtable,booktabs}
\begin{document}
\begin{longtable}{ll}
  % include if you want a different header on the first page
  \toprule
  Header 1 & First page only\\
  \midrule
  \endfirsthead
  % include if you want a header on all or all-but-the-first pages
  \toprule
  Header 2 & All later pages\\
  \midrule
  \endhead
  % include for a footer on all pages
  \bottomrule
  \endfoot
  some & stuff\\
  and & lots\\
  of & it\\
  ...
  finally & this\\
\end{longtable}
\end{document}

相关内容