Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question stems from Add text at an optional page-break only when breaking occurs and David Carlisle's excellent answer.

The question there was how to put text between tables when there is an (optional) page-break, e.g.

[ Table 1 ]
   Continued on next page
---- page break ----
   Continued from previous page
[ Table 2 ]

David's answer was to use a . The question I have here is if one has three or more tables, how can one insert custom text between each table when there is a page break between them. For example:

[ Table 1 ]
   The result of Table 1, XYZ, is carried over to the next page.
---- page break ----
   The result of Table 1 being: XYZ (for more details see the previous page)
[ Table 2 ]
   The conclusion of Table 2, XYZ, is used on the next page.
---- page break ----
   The conclusion of Table 2, being: XYZ, is calculated on the previous page.
[ Table 3 ]

The problem with the longtable is that the optional text must be identical between tables (i.e. one cannot customize it as between tables). Multiple longtable environments would overlap (i.e. a longtable for Table 1 + 2, and Table 2 + 3).

Is there a solution where one can have 'custom' optional text between tables that break across a page?

I would expect that a solution for tables could be extended to parboxes.

Thanks for reading.

share|improve this question
1  
As I commented on an answer on this site the other day, there isn't any great reason really for LT's headers to be fixed, it only really needs then to have fixed height (otherwise it's page breaking calculations would be upset) that and the syntax used by LT lending itself to setting the table head and saving it in a box rather than saving the commands in a macro to be reset. Perhaps.... –  David Carlisle Mar 8 '12 at 20:10

1 Answer 1

Perhaps something like this, uses \label so takes a few iterations to stabilize, also this version doesn't react too kindly if there isn't space to fit the "continued on next page" bit under the table as it comes on the next page, then forces a page break. probably fixable but this will get you started

\documentclass{article}

\textheight.5\textheight

\makeatletter
\newcount\bt@count


\def\breaktext#1#2{%
\par
\nobreak
\global\advance\bt@count\@ne
\expandafter\label\expandafter{\the\bt@count bt@count}%
\edef\@tempa{\csname r@\the\bt@count bt@count\endcsname}%
\global\advance\bt@count\@ne
\edef\@tempb{\csname r@\the\bt@count bt@count\endcsname}%
\expandafter\ifx\expandafter\relax\@tempa
\typeout{relax}%
\penalty\z@
\else
\typeout{[\@tempa][\@tempb]}%
\ifx\@tempa\@tempb
\typeout{equal}%
\penalty\z@
\else
\typeout{page break}%
#1\par\break#2\par\nobreak
\fi
\fi
\expandafter\label\expandafter{\the\bt@count bt@count}%
\nobreak
}


\begin{document}


\fbox{\parbox[c][4.5cm][c]{.25\textwidth}{ONE}}


\breaktext{table one continues\ldots}{continued from before}

\fbox{\parbox[c][4cm][c]{.25\textwidth}{TWO}}

\breaktext{table two continues\ldots}{continued from before}

\fbox{\parbox[c][6cm][c]{.25\textwidth}{THREE}}

\breaktext{table three continues\ldots}{continued from before}

\fbox{\parbox[c][1cm][c]{.25\textwidth}{FOUR}}

\breaktext{table four continues\ldots}{continued from before}

\fbox{\parbox[c][2cm][c]{.25\textwidth}{FIVE}}


\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.