# Encouraging LaTeX to more evenly distribute figures/floats across all pages?

I frequently run into a situation where several pages will be nothing but blocks of text, and later there will be several pages with multiple images. Is there a way to loosen how closely the figure stays near the text it's placed in so that the images spread across pages more evenly?

Ideally, would be some parameter which defines the trade-off between being close to where the figure is mentioned in the text and distributing the figures more evenly across pages. A solution which explicitly restricts the number of figures per page is ok, but less ideal. A parameter which indirectly effects this would also be ok (e.g., figures which total some certain size allowed per page).

Just to make clear, in every case, this is not intending that a figure has its own page with nothing else on it. It should still share the page with text.

• Welcome to tex.sx. One of the principles followed by math publishers is that a figure should appear as close to its first reference as possible. So if there is a reference to multiple figures, they really shouldn't be arbitrarily spaced out just so that a single page won't be packed with figures. – barbara beeton Apr 18 '19 at 17:47
• @barbarabeeton: I agree that for technical reasons the figure should certainly be placed as close as possible to its reference. However, for aesthetics and eye-relief, the same is not necessarily true. For most situations LaTeX's default arrangement seems appropriate. I only intend to use this "loosening parameter" for special uses. But it's definitely good that you noted this! – Shiania White Apr 18 '19 at 17:53
• You can control the number of figures on a page. I'm sure that there is an SE answer about this but I can't locate it; The memoir documentation section Where LaTeX puts floats (> texdoc memoir) describes what you can do about placements in general. My feeling about your question is that if you are concerned about the aesthetics then you should manually distribute your figures accordingly. It might be possible to get (La)TeX to, say, distribute figures evenly throughout a document but a 100 page document with 100 figures what would the first/last page look like? – Peter Wilson Apr 18 '19 at 18:18
• Usually when that happens it is some user markup, such as using [h] that is preventing the figures being placed, but for a discussion of a more global approach to pagination and float positioning see for example Frank's paper here (linked from teh latex-project website) latex-project.org/publications/… – David Carlisle Apr 18 '19 at 18:24
• if ther are pending floats then at each page break latex tries to output them, so if you are getting a run of pages with no figures output then the first figure on the queue can not be placed for some reason. It would not help to keep track of how many pages it is being deferred, as the float parameters are set in a way that blocks it (perhaps set so that the float is too large for a text page and too small for a float page, which can not happen with the default values but it can easily happen if they are changed without considering this possibility) – David Carlisle Apr 18 '19 at 18:30

If you have pending floats but a run of text pages with no floats output then something is preventing the floats from being added to the page. The usual reason is a poor choice of optional arguments or the float placement parameters.

Consider the following two documents which are the same except for the optional argument on two figures.

In the first the figures are fairly evenly spread with at most one per page, in the second all the text pages are output with no floats until a \clearpage flushes the floats so you get pages of floats with no text, then finally the remaining text with no floats.

\documentclass{article}

\usepackage{graphicx,lipsum}

\begin{document}
\lipsum[1]

\begin{figure}  \centering  \includegraphics[height=.8\textheight,width=2cm]{example-image}\caption{}\end{figure}

\lipsum[2]

\begin{figure}  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum[3]

\begin{figure}[t]  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum[4]
\begin{figure}  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum

before clearpage

\clearpage

after clearpage
\lipsum[5]

\end{document}


\documentclass{article}

\usepackage{graphicx,lipsum}

\begin{document}
\lipsum[1]

\begin{figure}[ht]  \centering  \includegraphics[height=.8\textheight,width=2cm]{example-image}\caption{}\end{figure}

\lipsum[2]

\begin{figure}  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum[3]

\begin{figure}  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum[4]
\begin{figure}  \centering  \includegraphics{example-image}\caption{}\end{figure}

\lipsum

before clearpage

\clearpage

after clearpage
\lipsum[5]

\end{document}

• In my case, I believe wrapfigs being included may be part of the problem. – Shiania White Apr 25 '19 at 0:52
• @ShianiaWhite wrapfigures are not floats so that would be a completely new question. If you do ask a new question please (a) mention wrapfig!! and (b) include a complete small test document like the ones in this answer that shows the problem. – David Carlisle Apr 25 '19 at 6:44