Page split between longtable caption and table
Assuming you want to have at least 3 rows of the longtable
to show up before considering a page break to be unacceptable, you could load the needspace
package and issue the directive
\Needspace{5\baselineskip}
immediately before \begin{longtable}
. That way, unless there are at least 5 lines of text still free at the bottom of the page, the longtable
will start at the top of the next page.
Why 5\baselineskip
? Because the longtable's caption and the blank line between the caption and the start of the body of the text take up 2 more lines.
You can simply use \\*
instead of \\
after the \caption
. From the manual:
\\*
: The same as\\
but disallows a page break after the row.
longtable
has some macros to control headings (cf. manual section 3). Depending on your use-case, have a look at \endhead
or \endfirsthead
. This code works for me:
\documentclass{report}
\usepackage{lipsum}
\usepackage{longtable}
\begin{document}
\lipsum[1-4]
another paragraph
another paragraph
another paragraph
another paragraph
anoteher paragraph
\begin{longtable}{lr}
\caption{\lipsum[1][1-3]}\\
\hline
\endfirsthead
A&B\\
c&D\\
E&F
\end{longtable}
\end{document}