Document Classeslongtable with strange page break just for head line

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
nKf
Posts: 2
Joined: Mon May 26, 2008 3:00 pm

longtable with strange page break just for head line

Post by nKf »

with the attached minimal .tex example longtable produces a pagebreak just for the head line and for the caption. see .pdf file for the result.

is it possible to tell longtable to place at least 3 rows to each page? if yes, how?
if there is a other or better package than longtable, please let me know.

greetings
stefan
Attachments
test.pdf
(9.39 KiB) Downloaded 574 times
test.tex
(416 Bytes) Downloaded 360 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

longtable with strange page break just for head line

Post by Stefan Kottwitz »

Hi Stefan,

perhaps the needspace package could be useful for you, for example:

Code: Select all

\usepackage{needspace}
...
\needspace{8\baselineskip}
\begin{longtable}[h]{|c|c|}
...
For the documentation look inside needspace.sty.

Stefan
LaTeX.org admin
nKf
Posts: 2
Joined: Mon May 26, 2008 3:00 pm

longtable with strange page break just for head line

Post by nKf »

Hi Stefan,

thanks for your answer. Unfortunately needspace does not help.

But I have found a solution with modifying longtable.sty. I must admit that I do not know exactly what I am doing. :) But the results look much better for me.
  • \ifvoid\LT@foot\else
    \advance\vsize-3\ht\LT@foot
    \global\advance\@colroom-3\ht\LT@foot
    \dimen@\pagegoal\advance\dimen@-3\ht\LT@foot\pagegoal\dimen@
    \maxdepth\z@
    \fi
On the other hand longtable works better if the caption is at top of the table. So finally I decided to use this way instead of modifying longtable.sty.

Greetings
Stefan

Addition:
Ok, I found one other mistake in my example. Longtable places the caption like a simple row. So the caption has to be defined in \endfoot or \lastendfoot section. But this does not solve the problem. It seems, longtable does not take the size of lastendfoot into account while calculating the pagebreak.
Post Reply