# How to place a table on a new page with landscape orientation without clearing the current page?

I'd like to place a table on a new page with landscape orientation. To do so, I use

\usepackage{pdflscape}
...
\pagestyle{empty}
\begin{landscape}
\begin{table}[htbp]
\begin{center}
\begin{tabular}{llll}
...
\end{tabular}
\end{center}
\end{table}
\end{landscape}
\pagestyle{plain}


However, this clears the current page, places the table on the next page with landscape orientation, and restarts typesetting in a new page with portrait orientation.

Question I'd like to place the table on a new page (as it is currently done) but to avoid to clear the current page. Is that possible?

Thanks!

-
Do not use center inside table but \centering instead. DO NOT USE FORMATTING environments AROUND floating environments like table or figure. EVERYTHING for it must be placed inside the floating environment. –  Martin Scharrer May 25 '11 at 13:06
Related question: How to wrap text around landscape page. –  Martin Scharrer May 25 '11 at 13:09
#Martin Scharrer: Thank you! –  Marco May 25 '11 at 13:14
@Macro: I adapted my linked answer to this specific case. The my answer below. (Also note that you need to write @username not #username, but this might just be a typo.) –  Martin Scharrer May 25 '11 at 13:21

Similar like my answer to How to wrap text around landscape page I would use \afterpage from the afterpage package to place the table at the next page of where it was declared. Here a non-floating replacement of table is used instead, e.g. the \captionof{table}{...} is used (capt-of or caption) package.

One issue are potential other tables which should be flushed beforehand. Otherwise the non-floating table replacement might appear earlier.

\documentclass{article}

\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{capt-of}% or use the larger caption package

\usepackage{lipsum}% dummy text
\begin{document}
\lipsum % Text before
\afterpage{%
\clearpage% Flush earlier floats (otherwise order might not be correct)
\thispagestyle{empty}% empty page style (?)
\begin{landscape}% Landscape page
\centering % Center table
\begin{tabular}{llll}
A & B & C & D \\
\end{tabular}
\end{landscape}
\clearpage% Flush page
}
\lipsum % Text after
\end{document}

-
your answer helped me to solve a long standing issue. Thanks a ton ! –  user6504 Jul 3 '11 at 11:15
Super!!! I am glad to see this answer!!! –  FEQ Aug 14 '12 at 17:51
@MartinScharrer, what do you mean by "flushing potential tables beforehand"? I guess, in my case your solution doesn't work exactly because of that, but I am not expert enough to be sure about... –  Py-ser Sep 3 '14 at 6:45
@Py-ser: I mean to flush the float buffer, e.g. place all processed but not yet placed tables or figures. You can force that using \clearpage. However, this creates a page break, so \afterpage{\clearpage} would be better. This forces the placement of any yet unplaced floats after the next normal page break. Not that this will lead to top placement (like the [t] optional argument of {table} would do) or a full float page (like [p]) if there are more or larger floats to be placed. As you can see, my code above uses \clearpage as the first command in \afterpage to do exactly that. –  Martin Scharrer Sep 3 '14 at 14:02
@MartinScharrer, thanks! Does this still hold in a two-columns case? I can't manage to avoid blank breaking before the landscape page. –  Py-ser Sep 4 '14 at 5:37

You could use the sidewaystable environment from the rotating package; a little example:

\documentclass{article}
\usepackage{rotating}

\begin{document}
text text text text
\begin{sidewaystable}
\centering
\rule{3cm}{4cm}% to simulate a table
\caption{A rotated table}
\label{tab:test}
\end{sidewaystable}
text text text
\end{document}

-
I have tried it but it produces the same result as with pdflscape. However, afterpage makes it work, as suggested in the link provided by Martin Scharrer. Thank you very much for your answer! –  Marco May 25 '11 at 13:14
@Marco: sidewaystable and sidewaysfigure let the text flow. I'd be really interested in seeing an example in which the text doesn't flow. Could you please provide such a minimal example? –  Gonzalo Medina May 25 '11 at 18:07
@GonzaloMedina, how can I let the table take one whole page and centered in that page, within the sidewaystable context? –  Py-ser Sep 4 '14 at 9:51