[Tex/LaTex] How to rotate landscape table page in PDF

floatslandscaperotatingtables

Currently I am using

\usepackage{rotating}

\begin{sidewaystable}
\begin{tabular}...\end{tabular}
\end{sidewaystable}

to typeset landscape tables, which works great.

But I want to rotate that page in the resulting pdf (generated by pdflatex) for more convenient screen reading.

I found the landscape environment which is also mentioned in another question. I tried it like this:

\usepackage{pdflscape}

\begin{landscape}
\begin{table}
\begin{tabular}...\end{tabular}
\end{table}
\end{landscape}

This kind of works, except the original table does not fit anymore on the page, i.e. sidewaystable makes better use of the available space.

Thus my question: Is it somehow possible to just use sidewaystable and instruct pdflatex to rotate it?

Or instruct pdflatex to mark it as rotated such that the PDF viewer knows what to do?

Best Answer

To make the table fit your landscape, put this in your preamble:

\usepackage{geometry}
\usepackage{pdflscape}

And for your landscape page, do this:

\newgeometry{margin=1cm} % modify this if you need even more space
\begin{landscape}

%put your table here

\end{landscape}
\restoregeometry

If you are working in a document that makes use of fancyhdr, you might want to put \thispagestyle{empty} on your landscape page so that you can make use of the space normally occupied by the header/footer. (and it looks cleaner in my opinion)