Is it possible to specify where the preferred page breaks in a longtable are? I'm trying to create a longtable with three types of rows:
- rows which should never be followed by a page break
- rows which can be followed by a page break if necessary
- rows which mark the preferred page break locations
I know that \\*
will get me rows of type 1, but I don't know how to accomplish the other two.
Also, while there will generally be a row of type 2 or 3 every two or three rows, I'd still like to avoid big blocks of white space at the bottom of the page by introducing some stretchable spaces after each row:
- 0pt plus 1pt
- 0pt plus 1pt
- 12pt plus 6pt
I know I can use \\[12pt]
to introduce a fixed amount of distance after a particular row, but changing this up for a stretchable space raises errors.
I've been able to do something like this in a list environment before by redefining \item
, \par
, and \\
, but now need the header and footer capabilities of longtable. Is it possible to define some variants on \\
or \tabularnewline
inside the longtable environment which will accomplish both these goals?
MWE (doesn't actually do much, but it gives you something to play with):
\documentclass[12pt,a5paper]{article}
\usepackage{longtable}
\newcounter{bla}
\newcommand\bla{\stepcounter{bla}row\thebla}
\setlength{\baselineskip}{12pt plus 1pt}
\begin{document}
\begin{longtable}{c}
\bla \\* \bla type 2 \\ \bla \\* \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\bla \\* \bla type 2 \\ \bla \\* \bla type 3\\[12pt]
\end{longtable}
\end{document}
\\*
) or forced break (\\ \pagebreak
) make sense. If you modified things to only have finite glue at the end then\\ \noalign\penalty 500
might start to make a difference, perhaps... You can use\\ \noalign{\vspace{10pt plus 10pt}}
most likely