[Tex/LaTex] How to wrap text around a landscape table over multiple pages? \sidewaystable or \landscape + \longtable

landscapelongtablepage-breakingrotatingtables

I am trying to create a landscape table that breaks over multiple pages. I have successfully done this with the following code:

\begin{landscape}
\begin{longtabu} to \textwidth{some columns}
\caption[my caption]{my caption}
table code here
\end{longtabu}
\end{landscape}

This does almost everything I want. I insert this code in my desired section of my document.

The problem is that the text breaks for the landscape environment. I have a paragraph at the top of the page and then because I inserted my table code after this paragraph, the rest of the page is blank, and then on the next pages is my landscape table. I want the text to go until the end of its page and then the landscape environment to run its thing for my table.

The text will wrap if the \begin{landscape} is changed to \begin{sidewaystable}. However, sidewaystable will not break over multiple pages; it does not allow a longtable or longtabu to work.

So sideways table won't allow a longtable and landscape won't allow text wrapping.

I've searched around on here and on Google but most of the solutions are suggesting to use either sidewaystable or landscape. However, none of the solutions really address my specific problem.

Does anyone have any suggestions how to proceed?

I wish I could show an image but I'm not allowed to post one as a new user.

Best Answer

If you are feeling brave you can use the afterpage package and go

\afterpage{\begin{landscape}.....\end{landscape}}

If the table is big (or it has any verbatim material) it is better to put it in a separate file mytable.tex and then just have

 \afterpage{\input{mytable}}

this isn't a real float but it does delay starting the table until the next page break.

Related Question