3

I have a large, horizontal table that spans multiple pages. LaTeX puts a page break before the table, but I don't want a page break. I want the text to fill the page before the table. I've tried \nopagebreak, but it doesn't work. How can I not allow a page break before the table and fill the page preceding the table with text? Here is a small example:

\documentclass{article}

\usepackage{longtable}
\usepackage{threeparttablex}
\usepackage{lscape}
\usepackage{tabu}

\begin{document}

I do not want a page break here
\nopagebreak

\begin{landscape}
  \begin{ThreePartTable}
    \begin{longtabu}{X[l] X[l] X[l]} \hline 
    Column1 & Column2 & Column3   
    \end{longtabu}
  \end{ThreePartTable}
\end{landscape}

I want this text to go before the table

\end{document}
  • I'm a little confused on exactly what you are going for. Are you looking to rotate the table sideways or switch your document to landscape orientation for the pages that contain the table? – andy mcevoy Sep 23 '13 at 21:54
  • I'm trying to fit a wide table that spans multiple pages in a document. This is the best way I've found (to have the table be in landscape mode). The table appears the way I want it to. I just don't want the page break on the page that precedes the table. – itpetersen Sep 24 '13 at 2:48
  • Switching to landscape produces a page break. How do you want your text to fit with that? – Andrew Swann Sep 24 '13 at 8:41
  • I just want the text to fill the page preceding the table. If there's a better way to do the table that doesn't force a page break, that's fine. – itpetersen Sep 24 '13 at 13:15
1

longtables do not float like table so in general they appear in the text stream where placed and text after the table is never set before.

However you can use \afterpage to delay the table a certain amount, you could possibly include the whole table in the argument of \afterpage but if it is really long it's probably better to put it in an external file as here:

\begin{filecontents}{lt1}
\begin{landscape}
  \begin{ThreePartTable}
    \begin{longtabu}{X[l] X[l] X[l]} \hline 
    Column1 & Column2 & Column3   
    \end{longtabu}
  \end{ThreePartTable}
\end{landscape}
\end{filecontents}
\documentclass{article}

\usepackage{longtable}
\usepackage{threeparttablex}
\usepackage{lscape}
\usepackage{tabu}
\usepackage{afterpage}

\begin{document}

I do not want a page break here

\afterpage{\input{lt1}}

I want this text to go before the table

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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