I am trying to allow more flexibility to the placement of figure environments.
More specifically, say that a section ends 5cm before the bottom of the page, and ends with a figure environment, which takes up 10cm of the page. The float gets pushed to the next page, and occupies the whole page. Then, the new section starts on the following page.
How can I allow the placement to be more flexible? Ideally, the float should be pushed to the top of the first page not containing a section title. This would render like so:
+-------------+-------------+-------------+
| Lorem ipsum | ยง2 Title | +---------+ |
| Lorem ipsum | | | | |
| Lorem ipsum | Lorem ipsum | +---------+ |
| Lorem ipsum | Lorem ipsum | Fig. Abc |
| Lorem ipsum | Lorem ipsum | |
| Lorem ipsum | Lorem ipsum | Lorem ipsum |
| | Lorem ipsum | Lorem ipsum |
| 1 | 2 | 3 |
+-------------+-------------+-------------+
Here is a MWE producing the un-desired output.
\documentclass{book}
\usepackage{mwe,lipsum}
\let\oldsection\section
\renewcommand\section{\clearpage\oldsection}
\begin{document}
\section{Title One}
\lipsum[1-3]
\begin{figure}[ht]
\centering
\includegraphics{example-image}
\caption{Caption}
\end{figure}
\section{Title Two}
\lipsum[1-3]
\end{document}
Note that indeed, as David Carlisle suspected, I am using a \clearpage before each section. I would like to keep this behaviour as is.
lipsumpackages to make easily dummy text and the images of themwepackage to simulate your figures. โ Fran Mar 17 '24 at 23:53bfloats orpfloats? also with a standard definiton of section headings I don't see why this should do as you describe and make a page just containing the float as you have removed thepfloat page option. Unless your\sectiondo\clearpageand flush floats (which is normally something\chapterdo but not lower level headings) โ David Carlisle Mar 18 '24 at 00:48