[Tex/LaTex] How to spread floats automatically over a whole chapter

floatspage-breaking

In a chapter with many figures, I'm having trouble to get the floats to be interlaced with the text. To quote http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions:

Authors sometimes have many floats occurring in rapid succession,
which raises the problem of how they are supposed to fit on the page
and still leave room for text. In this case, LaTeX stacks them all up
and prints them together if possible, or leaves them to the end of the
chapter in protest. The skill is to space them out within your text so
that they intrude neither on the thread of your argument or
discussion, nor on the visual balance of the typeset pages.

I somehow feel this can't be the point, to have to manually spread the figures within the source file so that LaTeX will feel compelled to produce a visually pleasing result (if I felt that's how a typesetting software should work I'd be using Word). Why can't I just take a bunch of floats and tell LaTeX: "You take these and put them somewhere in this chapter. I know you can do it!"

I produced a MWE that shows that neither putting text before nor after a bunch of figures will help.

\documentclass{article}
\usepackage{mwe}
\begin{document}
\blindtext\par\blindtext\par\blindtext\par\blindtext\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{A figure.}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{A figure.}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{A figure.}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{A figure.}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{A figure.}
\end{figure}
\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par\blindtext\par
\end{document}

texttexttextfigurefigurefiguretexttexttext

I know I could just use \begin{figure}[t] and would get what I want but, again, it can hardly be the point of floats to force them into a certain position. I am willing to let LaTeX put floats on a float page or at the bottom or whereever, as long as it at least tries to achieve a decent result. Mixing text and figure on one page and not on the others doesn't make any sense in any typography universe that I can conceive.

Best Answer

Page breaking in TeX is considered at each break (unlike linebreaking which is optimised over a paragraph) mostly because of the memory constraints at the time the system was devised. On the first break LaTeX has enough text and a float to make a t float. It then has not got enough text to make a text page (as the rest of the text has not been seen) but it does have some pending floats which are bigger than half a page so allowed to make a float page so it does that. It chooses the best option available at that point – it doesn't hold things back in case some more text comes along later.

Since global optimisation for page breaks is not possible, your only choice is to force TeX to hold floats back until more text is available. Adding this to the preamble

\renewcommand\floatpagefraction{.75}
\makeatletter\def\fps@figure{htbp}\makeatother

Tips the balance away from float pages. The first line says a float page should be three quarters full (making float pages less likely) and the second adds h to the list of default float areas (making text floats more likely).

enter image description here

One of the downsides is, of course, that it becomes more likely that floats are held back until TeX reaches a float barrier and then has to dump them heedlessly. Another drawback is that actually aesthetically pleasing solutions might be prevented.

Related Question