A typical solution while using the landscape environment provided by the pdflscape package is to wrap the landscape into an \afterpage{} environment to prevent clearing the page between the part to be rotated and the preceding text. In this way, the following text flushes before the landscape-oriented page until the landscape page comes.

Is there any equivalent to \afterpage{} that positions the landscape page before the page in which it is called instead of after it? More often than not, figures, tables, diagrams and the like are best inserted in a textflow before they are described textually, so this solution would come in handy in those situations.

I have not included any MWE as I am not referring to any specific problem I have experienced.


No. This isn't possible (without changing the whole output routine). TeX works token-by-token, paragraph-by-paragraph, page-by-page. When the macro on page n is read, page n-1 is done and dusted. (This isn't quite true - LaTeX does peek a little ahead, but only a little and nothing like a whole page.)

If you are happy to put the picture on this page and move everything else from this page to the next page, rather than putting the picture on the previous page, then you can, as David says, insert a page into the output to achieve this.

Here's a very crude version as proof-of-concept:

\kant[1-4]% this text runs from page 1 to page 2, but ends up on page 1 and page 3
\shipout\vbox{% this code is on page 2 and ends up on page 2
\kant[5-7]% this ends up on page 3 and later

inserted page

  • 1
    it wouldn't be that hard to insert a page – David Carlisle Aug 13 '17 at 22:04
  • @DavidCarlisle No. But that wouldn't put it on the previous page. It would put it on this page and move the rest of the stuff from this page to the next page. I thought that was the question. – cfr Aug 13 '17 at 22:25
  • 2
    since a landscape page is a complete page insert it comes to the same thing. It just depends how you define "this page" you can not change the text in the previous page for the reasons you give above but you could output a page before rather than after the current page – David Carlisle Aug 13 '17 at 22:34
  • @DavidCarlisle Well, nothing ends up on the previous page, was my point. But, yes, it isn't clear that is really wanted in this case. Maybe .... – cfr Aug 14 '17 at 0:09
  • As there seem to be no straightforward solutions, only workarounds, wouldn'it be more simple to move the \afterpage{...} a few paragraphs up so that it actually ends up on the desired page? – poxx Aug 14 '17 at 10:11

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.