I have a document (article class) in which sections of text are interrupted by sideways tables. In order to be able to view the document properly I am using

\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}


\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}

to turn the pages in the viewer.

The turning works well however I cannot use \newpage after a text section and then rotate using pdfpageattr without inserting text inbetween. If I do that all the tables disappear. Here an example of this:

text I dont Want But Need To But There For Tables to show up!
% FS Tables

\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}

%%% Table I: Loan Amount
       \caption{Loan Amount - Closest-Saathi to Client km}

I would usually include a minimalist document here but in this case it seems rather complicated because I am importing tables etc. Perhaps we can answer the question this way.

  • Does \clearpage after sidewaystable helps? Sep 13 '12 at 14:29
  • It does. Thank you! What's the logic behind that?
    – Max
    Sep 13 '12 at 14:35
  • Have a look at the pdflscape package.
    – egreg
    Sep 13 '12 at 14:48

The problem is that sidewaystable can float. Since you probably want to allow it to continue to float, here is an outline of how to deal with it, using the fact that fancyhdr can treat float-only pages differently.

\usepackage{lipsum} % For generating dummy text
    \iffloatpage{\global\pdfpageattr{/Rotate 90}}%
    {\global\pdfpageattr{/Rotate 0}}}

    \caption{here is the caption}
    here is a fake table



  1. This assumes that \pdfpageattr is normally empty. It would be easy to change the code in order to maintain a constant token list in \pdfpageattr. The way you redefined \pdfpageattr in the question, by appending to it each time, means that \pdfpageattr gets longer with each rotation;
  2. This will cause all full-page floats to be rotated, so you'll have to do something more sophisticated if you have a mixture of rotated and non-rotated full-page floats.

Environment sidewaystable is similar to table a floating environment. LaTeX stores these floating objects some time until it finds a place where it can put them. \clearpage forces the pending floating objects to be put on the page.

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.