How to prevent longtable to put header alone in one page like in image below. I used endhead
to prevent this but this will print the header on each page.
Sorry I don't give MWE because I haven't succeeded to reproduce it with minimum data.
longtablepositioning
How to prevent longtable to put header alone in one page like in image below. I used endhead
to prevent this but this will print the header on each page.
Sorry I don't give MWE because I haven't succeeded to reproduce it with minimum data.
Best Answer
As noted in
How to prevent page break between section title and table
You could use the
needspace
package to conditionally ad a\clearpage
if the heading is near the bottom of the page. (The problem that is solving is slightly different, a page break happening before the table, after the heading, whereas you have a page break within the heading).In general though, the simplest way in
longtable
to ensure that the first one or two lines of the table body stick to the first table head is to put the\endfirsthead
line after those lines. You may think of them as part of the table body but if you want them always to stick with the head, putting them in the head works well. Similarly you can if needed put the last line or two into the top of the\endlastfoot
so that they stay with the table footer at the end of the table.