我有一个\longtable
带有\multirow
细胞的,如附图所示。
在这里,如果我尝试换行但页面底部没有足够的空间,那么句子的剩余部分就会超出表格范围。
如果我不强制打断但句子很长,也会出现同样的问题。
您认为\pagebreak
这是唯一的解决办法吗?
笔记:
- 我知道我给出了错误的行数
\multirow
(即\multirow[t]{5}{=}{item 1\newline pos. A}
而不是\multirow[t]{8}{=}{item 1\newline pos. A}
,但我正在处理数千行,这些行在文档的未来修订中其长度将会改变,因此,对我来说,计算数量更容易\square
(无论如何,这似乎不是我的问题的原因)。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{pdflscape}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\begin{landscape}
\begin{longtable}{|p{4cm}|p{10cm}|p{4cm}|p{4cm}|}
\hline
COMPONENT & CHECKS DESCRIPTION & CHECKED – NOTE & CHECKED – NOTE\\
\hline
\endfirsthead
\hline
COMPONENT & CHECKS DESCRIPTION & CHECKED – NOTE & CHECKED – NOTE\\
\hline
\endhead
\hline
\endfoot
\hline
\endlastfoot
\multirow[t]{5}{=}{item 1\newline pos. A} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{4}{=}{item 2\newline pos. B} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{5}{=}{item 3\newline pos. C} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{3}{=}{item 4\newline pos. D} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\end{longtable}
\end{landscape}
\end{document}
答案1
正如@leandriis 所指出的,您应该\\*
在不需要分页符的地方使用。更准确地说:如果您想将“行块”保持在一起,请\\*
在它们之间使用,但\\
在末尾使用以允许在那里分页。在您的示例中,s\hline
也允许分页符,因此严格来说您也可以\\*
在它之前使用,但我认为不这样做更干净。
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{siunitx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{pdflscape}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\begin{landscape}
\begin{longtable}{|p{4cm}|p{10cm}|p{4cm}|p{4cm}|}
\hline
COMPONENT & CHECKS DESCRIPTION & CHECKED – NOTE & CHECKED – NOTE\\
\hline
\endfirsthead
\hline
COMPONENT & CHECKS DESCRIPTION & CHECKED – NOTE & CHECKED – NOTE\\
\hline
\endhead
\hline
\endfoot
\hline
\endlastfoot
\multirow[t]{5}{=}{item 1\newline pos. A} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{4}{=}{item 2\newline pos. B} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{5}{=}{item 3\newline pos. C} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\multirow[t]{3}{=}{item 4\newline pos. D} & check this doing that text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\*
& check this doing that text text text text text text text text text text text text text & $\square\ldots$ & $\square\ldots$\\
\hline
\end{longtable}
\end{landscape}
\end{document}