带有书页标签的长表,中间规则被推到下一页

带有书页标签的长表,中间规则被推到下一页

我想在横向模式下制作一个正式的长表。我使用 booktabs 使表格正式化。这是一个示例 tex 文档:

\documentclass{article}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{lscape}
\begin{document}
\blindtext[5]
\begin{landscape} \sffamily{%
\begin{longtable}{>{\raggedright}p{7cm}>{\centering}p{7cm}}
\toprule 
Header & \\
\midrule
\endhead
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\bottomrule
\end{longtable}}\end{landscape}
\end{document}

当文档编译(pdflatex)时,第 2 页最后一行(第 10 行)下方的规则(midrule)被推到下一页,导致标题行下方出现双线。为什么会出现这种情况?如何修复?

编辑:

这是另一个示例,表格稍微复杂一些,有第一个页眉、页脚、页脚和最后一个页脚,也出现了类似的问题。我该如何修复这个问题?

\documentclass{article}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{lscape}

\begin{document}
\blindtext[5]

\begin{landscape} \sffamily{%
\begin{longtable}{>{\raggedright}p{7cm}>{\centering}p{7cm}}
\toprule 
First Header & \\
\midrule
\endfirsthead
\toprule
Header & \\
\midrule
\endhead
Footer & \\
\midrule
\endfoot
Last Footer & \\
\bottomrule
\endlastfoot
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\blindtext[2] & \\
\midrule
\end{longtable}}\end{landscape}
\end{document}

在此处输入图片描述

答案1

您必须使用\\*而不是\\。这样\midrules 就会与其所在行保持在一起。

梅威瑟:

\documentclass{article}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{lscape}
\begin{document}
\blindtext[5]
\begin{landscape} \sffamily{%
\begin{longtable}{>{\raggedright}p{7cm}>{\centering}p{7cm}}
\toprule
Header & \\
\midrule
\endhead
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\midrule
\blindtext[2] & \\*
\bottomrule
\end{longtable}}\end{landscape}
\end{document} 

在此处输入图片描述

相关内容