Is it possible to have float-only pages, containing sideways tables or figures produced by the sidewaystable or sidewaysfigure environments of the rotating package, automatically rotated in the PDF output?

This question is related to 3 existing questions:

Rotate single PDF page when viewing

floating sideways table on a rotated page in pdf-viewer

Problems with newpage and pdfpageattr

I've tried the answers given there, based on \pdfpageattr and \afterpage from the afterpage package, with or without \BeforeBeginEnvironment and \AfterEndEnvironment from the etools package, or even modifying directly the definition of sidewaystable say, something like

   \global\pdfpageattr\expandafter{/Rotate 90}}
  {\afterpage{\global\pdfpageattr\expandafter{/Rotate 0}}%

Things always end up like in this screenshot:

Screenshot showing several rotated pages

Namely, not only the page with the actual sideways table is rotated, but also the page where the sidewaystable environment appears in the LaTeX source.

Of course, it's always possible to rotate pages manually in the PDF output, but it would be nice to have sidewaystable etc. rotate the pages automatically. I'm looking for a solution that only rotates the PDF page where the sideways table or figure is floated to, without otherwise altering the formatting in any way (namely, no use of \clearpage, \pagebreak or the landscape environment).

1 Answer 1


It depends a bit on the engine how easy it is. With engines using dvi you can use a \special, which is then executed at shipout. luatex has \latelua which can be used too. With pdflatex you have to use a \label/ref system to keep track of the right page. A possible implementation is here https://tex.stackexchange.com/a/472608/2388.


With the new pdfmanagement of LaTeX which is currently provided as a testphase package you can do this (code updated 2023-10)(depending on the engine it will require two compilations):








\caption{large sideways table}



Be aware that it is not compatible with everything, check the document of pdfmanagement-testphase.


  • 1
    Many thanks for the speedy response! Both solutions (the original one here and the one at tex.stackexchange.com/a/472608/2388) work perfectly (except with XeTeX for the latter, but that's really minor, I wasn't planning of using XeTeX for this document anyway). I wasn't aware of the future PDF management capabilities of LaTeX; that's very cool indeed, it seems quite natural given the evolution of document processing. I look forward to seeing this included in standard LaTeX. Thanks again! Apr 26, 2021 at 14:58
  • Can we expect the advertisment environment, too? But this sounds very nice indeed ....
    – cfr
    Oct 13, 2023 at 20:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .