# How can I set the maximum number of rows in a page for longtable?

Making a complicated table is a pain in LaTeX. I am using a longtable in my TeX and need to change the maximum number of rows in a page. Is there any way to set the maximum number of rows in a page?

-
The number of rows in your table will depend on your paper size, font size and other things such as text or headings on that page. If you need to get more rows, try to enlage the page with \enlargethispage{<length>} (e.g. 2\baselineskip) or (not recommended) use the geometry package to change your page layout for the longtable pages. This will make your document slightly inconsistent, but might be alight in an appendix or so. – Martin H Jun 2 '11 at 16:43

It is true that the number of rows in your table depend on various parameters, such as the height of the page and of each row. However, you can always force a pace break at a given line by using \newpage or \pagebreak. You will have to add a \newpage command for each page you want to make by hand, which is OK if your table is not too long.

Alternatively, you can also make TeX insert a \newpage for you every n-th lines, add the following lines before your table:

\newcount\mylineno
\mylineno=0
\def\mynewline{%

and replace every \\ in the table lines with a \mynewline. Replace the number 20 above with the number of lines you want in your table.