I assume you are using a book
type of document class because they normally set \flushbottom
as the default, which gives you the behavior you are experiencing. So a trivial solution is, of course, to change that setting to \raggedbottom
in the preamble of your document (or the class if this is a private class). However, the downside of this approach is that then all pages will show a ragged behavior which, for a book or manual is normally not desired.
As an alternative you can just make the offending pages come out short by using a command like \maybeflushthispage
in front of all the places where you may have to break a page short (i.,e., in your case the in front of all figures of type [H]
).
\documentclass{book}
\usepackage{lipsum,float}
\setlength\textheight{26\baselineskip}
\newcommand\maybeflushthispage{\vfil\penalty1000\vfilneg}
\begin{document}
\lipsum[1-2]
\maybeflushthispage
\begin{figure}[H] \rule{5pt}{4cm} \end{figure}
One line here \ldots
\maybeflushthispage
\begin{figure}[H] \rule{5pt}{4cm} \end{figure}
\lipsum[1]
\end{document}
If you run this then \maybeflushthispage
will flush the page if a break is taken (first page) but will do nothing otherwise (second page):