3

In a book, I have some figures, that are so big that they get their own [p] page. If possible (by restrictions of the next chapter for example or some other semantics), I would prefer having figures on even pages (on the left). I know I can force them to be there, but then I ignore all other rules related to figure positioning. Is there a way to make figure pages prefer even pages?

mike
  • 333
  • 1
  • 3
  • 13
  • 1
    prefer is hard (as you need to implement some notion of ranking choices) but banning float pages on odd pages would be relatively easy (might already be an answer on site) You would not have to "ignore all other rules" – David Carlisle Jan 15 '24 at 14:51
  • how would preference work. if there is a pending float that has to go on a float page and the next page is odd. when would it decide to place it there rather than delaying until the next page? at this point tex typically has not even read the next page from disk so it has no information about what is coming up. It has to decide to place or not place it on the odd page at this point. – David Carlisle Jan 15 '24 at 14:54
  • If by "prefer" you mean "except for \clearpage", that shouldn't be a problem. – John Kormylo Jan 15 '24 at 15:52
  • Hmm, yeah. I see. Those are good comments, and I didn't have enough understandign of the working principles. I figured prefer as in knowing what comes next and placing it or not depending on some badness measure, as it is with regular floats as well. – mike Jan 15 '24 at 16:32
  • @mike no regular floats have no knowledge of pages other than the current one, so if a float is too large for the current top area it will be defered and considered (or not) for a p column the choice of using p column at that point just has the information about the float size and whether p is used, so you could add a test at that point if page is even act as if the float is too large and defer it, but you can't say defer or not depending on anything on future pages. – David Carlisle Jan 15 '24 at 18:26
  • Thank you. It looks as if my original intention is not possible in Latex, from what I gather of your comments. I've now positioned the figures individually, just by moving the \figure{} command in the text. Thanks for the insights though. – mike Jan 16 '24 at 16:02

1 Answers1

3

The following document would position floats on pages 2, 3, 5 and 7

enter image description here

but adding the definition shown makes it defer float page choices on odd pages so they get placed on pages 2, 4 and 6

enter image description here

\documentclass{article}
\let\eject\relax% just in this example

\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: don't let floats on to odd numbered p pages @fpmin \ifodd\c@page\maxdimen\else\floatpagefraction@colht\fi } \makeatother \begin{document}

\input{story}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{12cm}

\caption{a figure} \end{figure}

\input{story}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{12cm}

\caption{a figure} \end{figure}

\input{story}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{4cm}

\caption{a figure} \end{figure}

\input{story}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{8cm}

\caption{a figure} \end{figure}

\input{story}\input{story}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{4cm}

\caption{a figure} \end{figure}

\begin{figure}[p] \centering \write300{float on page \thepage} \rule{3cm}{4cm}

\caption{a figure} \end{figure}

\input{story}\input{story}

\end{document}

David Carlisle
  • 757,742