2

Suppose I have two big float environments, e.g figures, and I want to display one of them on the left page and the other one on the right page. This happens because I'm more interested in the easiness of comparing the figures than having them near where they are defined.

What I could do right now is to set the specifier to p for both environments (not really needed since they are big enough to be placed in a float page by default), look where they are placed and, if the position is not what I desired, i.e. the first figure on the right page and the second on the next left page, change where I include the figures in the code.

This approach is annoying for two reasons:

  • Moving where I include the figures in the code just to obtain the right result means that sometimes in order to put the figures in the right place in the document I have to put them in another section in the code. The result is a wrong labelling.
  • If I add/remove content before that page the way they are displayed in the document could change again. Thus, I have to continuously move these figures until I have completed the document or I have to put them only in the end.

There is a way to say if a given figure must go on a left/right page? Alternatively, there is a way to define a double float page starting from a left page?

4

On a good day you could try afterpage, which isn't the most stable of packages but could be used to automatically get to the start of the next two page spread, at which point you can add the two figures.

enter image description here

\documentclass[a5paper,twoside]{article}

\def\zz{One two three four five six. \stepcounter{enumi} \Roman{enumi}, \roman{enumi}, seven eight nine ten. }
\def\zzz{\zz\zz red blue green \the\inputlineno, yellow.  \zz\zz\zz\par\zz\zz\zz}

\usepackage{afterpage}

\begin{document}

\begin{titlepage}
 zzz
\end{titlepage}
\section{One}

\zzz \zz\zzz



\section{Two}

\zz 
\afterpage{%
\ifodd\value{page}\relax
\expandafter
\afterpage
\fi
{\begin{figure}[p]
\raggedright
\rule{.7\textwidth}{.7\textheight}
\caption{on the left}
\end{figure}
\begin{figure}[p]
\raggedleft
\rule{.7\textwidth}{.7\textheight}
\caption{on the right}
\end{figure}}}

\zzz \zz \zz\zzz\zzz\zzz\zzz\zzz\zzz\zzz\zzz
\section{Three}
\afterpage{%
\ifodd\value{page}\relax
\expandafter
\afterpage
\fi
{\begin{figure}[p]
\raggedright
\rule{.7\textwidth}{.7\textheight}
\caption{on the left}
\end{figure}
\begin{figure}[p]
\raggedleft
\rule{.7\textwidth}{.7\textheight}
\caption{on the right}
\end{figure}}}

\zz \zzz\zzz \zz \zz \zzz
\afterpage{%
\ifodd\value{page}\relax
\expandafter
\afterpage
\fi
{\begin{figure}[p]
\raggedright
\rule{.7\textwidth}{.7\textheight}
\caption{on the left}
\end{figure}
\begin{figure}[p]
\raggedleft
\rule{.7\textwidth}{.7\textheight}
\caption{on the right}
\end{figure}}}
\zzz\zzz\zzz\zzz\zzz\zzz\zzz\zzz


\section{four}
\zz \zzz\zzz\zzz\zzz \zz \zz \zzz
\zz \zzz\zzz\zzz\zzz \zz \zz \zzz

\end{document}
  • You could have said that you have written it, I discovered it reading your documentation. You are definitely too modest. Thanks for your suggestion, I will give it a try. Just one more question: what could be the instability in this use case? – gvgramazio Dec 8 '18 at 10:51
  • see the footnote on page 1 of the afterpage doc, which decribed the status in 1992 or whenever it was, status hasn't really changed, It pokes in to parts of latex that were never intended to be poked and I never thought anyone would use it, but it seems people use it quite a bit so perhaps it works better than it should.... – David Carlisle Dec 8 '18 at 18:49

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.