22

I'm writing a two sided document (it will be printed as a book) and I've got two figures which takes up a whole page each. These two figures are related so I want them to be side by side in the resulting book, i.e. figure1 should be placed on an even page and figure2 should be placed on the following (odd) page.

Is there any way I can automatically achieve this?

This is how I'd like the resulting pages in the book to be:

|p2--------||p3--------|
|          ||          |
| Fig1     || Fig2     |
|          ||          |
|          ||          |
|(caption) ||(caption) |
|----------||----------|
5
  • 4
    Shouldn't the positioning be Even/Odd instead of the other way round?
    – lockstep
    May 13, 2012 at 14:27
  • 2
  • @lockstep: For print even/odd is the way to go. Unfortunately some PDF viewers like Adobe Reader display Odd/Even in double-sided mode. See the screen-shot in my answer below. May 13, 2012 at 14:42
  • There is no need to have EDIT markings in your posts. You should avoid them. The posts should simply show the latest version. All your edits can be seen in the post history (click on the "edited [at]"). May 13, 2012 at 15:07
  • @MartinScharrer: Even/Odd PDF viewers: That's strange, I thought Adobe had an options switch for that (although I don't use it). Pdf-XChange Viewer certainly does. May 13, 2012 at 16:10

1 Answer 1

20

This can be done using \afterpage similar to my more complex solution shown in How to include a picture over two pages, left part on left side, right on right (for books)?. Because the \afterpage code is processed directly after a page is written the page counter can be used directly without going over page labels as done by the ifoddpage package.

\documentclass{article}

\usepackage{afterpage}
\usepackage{mwe}% for the example only

\begin{document}

\blindtext\blindtext\blindtext
\blindtext\blindtext\blindtext

\afterpage{%
    \clearpage% flush all other floats
    \ifodd\value{page}
    %\else% uncomment this else to get odd/even instead of even/odd
        \expandafter\afterpage% put it on the next page if this one is odd
    \fi
    {%
    \begin{figure}[p]
        \includegraphics[width=\textwidth,height=.9\textheight]{example-image-a}%
        \caption{First image}\label{fig:first}
    \end{figure}
    \clearpage
    \begin{figure}[p]
        \includegraphics[width=\textwidth,height=.9\textheight]{example-image-b}%
        \caption{Second image}\label{fig:second}
    \end{figure}
    \clearpage
    }%
}

\blindtext\blindtext\blindtext
\blindtext\blindtext\blindtext

\end{document}

Result

3
  • 1
    Thank you very much, that is perfect! As pointed out in earlier comments it should start on an even page. I removed the line "\else" and it does as expected.
    – Paul
    May 13, 2012 at 15:01
  • @Paul: Wonderful. I updated my answer to reflect this. May 13, 2012 at 15:07
  • 3
    Unfortunately, Martin's solution does not always work. As is stated in the afterpage package documentation, the command \afterpage can and will get confused when there are many floats around. Any ideas on how to make Martin's solution more robust? (feel free to add this as a comment to Martin's answer) Mar 4, 2013 at 0:43

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