26

I am editing a longtable. Some of my cells contain a lot of text. Page breaks seem to happen only where table rows end/begin. I'd like, however, for the rows to span pages; it's fine with me if, for example, the first few lines of a row are at the end of one page and the rest of the row's lines are on the next page.

lockstep
  • 250,273
Cost
  • 4,517
  • 6
    it's not in general possible, consider if one cell is a large image and the next cell is text how would it break? p columns are essentially parboxes that do not break. – David Carlisle Oct 21 '12 at 19:44
  • 1
    Well, try to think about it for a while. Where should the cells be broken if the lines in them are not equally high? In one cell you nicely reach the "full height of a page" which in the other one you get an empty space at the bottom. Nah, this cannot work. – yo' Oct 21 '12 at 20:51
  • 1
    @DavidCarlisle Sounds like an answer to me! – Joseph Wright Nov 21 '12 at 08:32

2 Answers2

14

pagebreaks inside a cell are in general not possible but you can work with a trick if you really need a break. However, it makes no sense if you have a lot of such tables or pagebreaks.

Set the long table as usual and have a look into the pdf output of the cell where a pagebreak maybe usefull. Now insert in that cell at the last word of that line

 first col & ... some text\parfillskip=0pt \tabularnewline
           & and the follwing text which is on the next page.

With setting \parfillskip=0pt you'll get a left and right justified line.

13

It is not in general possible. Consider if one cell is a large image and the next cell is text how would it break? p columns are essentially \parboxes that do not break.

David Carlisle
  • 757,742
  • 1
    Just out of curiosity, seeing as how this question/answer is 3 years old, has there been any progress in permitting a cell to split across two pages? – EngBIRD Nov 11 '15 at 02:31
  • @EngBIRD No, a table cell is a box and boxes do not split across pages. (You could re-implement everything, not use the underlying \halign primitive, align everything by hand and invent some possible algorithm for trying to find a vertical point at which all columns split, but that would be a new package so nothing remotely like longtable or any other existing latex alignment package.) – David Carlisle Nov 11 '15 at 08:46
  • Thanks for the comment, I wasn't optimistic. I assumed that longtable wouldn't have changed, but I wasn't sure if someone after years of these kinds of comments or questions would have added the capability to disable the parbox or something that would permit a particular row's segmentation. Thanks again! – EngBIRD Nov 11 '15 at 18:09
  • 1
    @EngBIRD the underlying alignment mechanism is already a box, so there is nothing to remove: you would have to implement some completely different alignment mechanism not using \halign (the primitive behind all environments using & as a cell separator) – David Carlisle Nov 11 '15 at 18:39