3

How can I constrain a float to be positioned only on a new right (recto) page and never on a verso page?

I'd like behaviour similar to

\begin{figure}[p]

But as if there were a positioning option 'r' like...

\begin{figure}[r]

Which would only allow the float on a new recto page.

This is different to the request in this question: Figures on left pages, text on right ones with class book, numbering only on right pages or behaviour in the package semioneside which give text only on one side and figures only on the other.

As a MWE I'd like my A and B to be on odd pages with text on the even pages.

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}


\begin{document}

\begin{figure}[p]
  \resizebox{!}{\textwidth}{A}
\end{figure}
\begin{figure}[p]
  \resizebox{!}{\textwidth}{B}
\end{figure}

\lipsum
\lipsum

\end{document}
5

this only allows p on odd pages. Note that it doesn't redefine \clearpage (including its implicit use in \end{document} so any floats pending at the end of the document will be flushed irrespective of page number.

\documentclass{article}

\makeatletter
\def\@floatplacement{\global\@topnum\c@topnumber
    % Textpage bit, global:
   \global\@toproom \topfraction\@colht
   \global\@botnum  \c@bottomnumber
   \global\@botroom \bottomfraction\@colht
   \global\@colnum  \c@totalnumber
    % Floatpage bit, local:
   \@fpmin   \ifodd\c@page\floatpagefraction\@colht\else 2\textheight\fi\relax}
\makeatother

\def\t{%
\begin{figure}[p]
FFFFFF\\FFF\\FF\\F

\caption{ff ff ff}
\end{figure}

TTT TTT TTT TTT
}
\def\z{zz\par zzz\par zzzz\par zzzzz\par}
\begin{document}

\t\t\t\t\t\t\t\t\t\t\t\t

\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z
\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z
\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z
\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z

\end{document}
  • Thanks, that works really nicely, although I can't pretend to understand what it's doing! Making the minimum available height required for a float on an even page twice the possible text height (and so preventing its placement) perhaps? – Rupert Meese Sep 3 '14 at 15:53
  • @RupertMeese exactly:-) – David Carlisle Sep 3 '14 at 15:54
  • @RupertMeese apart from the added if test in setting @fpmin, the rest is a copy of the standard definition from the latex format. – David Carlisle Sep 3 '14 at 15:56

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.