14

According to the float package documentation, the H float placement specifier

[...]when added to a float, tells LaTeX to “put the float HERE, period”. If there isn’t enough space left on the page, the float is carried over to the next page together with whatever follows, even though there might still be room left for some of that.

I've heard some opinions in favour and some against the use of this placement specifier. I personally tend not to recommend its use and suggest the use of an static object from the beginning instead (but the only reason I have is that I don't like the idea of declaring something as a float and then suppressing the flotation; I'd rather use a static object from the beginning).

Are there any major drawbacks associated with the H float placement specifier besides the one mentioned in the last sentence of the quoted text?

Gonzalo Medina
  • 505,128

2 Answers2

7

Here is one drawback, that stems from the fact that [H] floats are set as a minipage:

enter image description here

\documentclass{article}
\usepackage{float}
\newcommand{\pangram}{The quick fox jumped over the lazy dog.}
\begin{document}
\pangram

\begin{figure}[h]
  \pangram
  \caption{\pangram}
\end{figure}

\pangram

\clearpage
\pangram

\begin{figure}[H]
  \pangram
  \caption{\pangram}
\end{figure}

\pangram

\end{document}

Another drawback is the way it handles "in-text floats":

enter image description here

\documentclass{article}
\usepackage{float}
\newcommand{\pangram}{The quick fox jumped over the lazy dog.}
\begin{document}
\pangram
\begin{figure}[h]
  \pangram
  \caption{\pangram}
\end{figure}
\pangram

\clearpage
\pangram
\begin{figure}[H]
  \pangram
  \caption{\pangram}
\end{figure}
\pangram

\end{document}
karlkoeller
  • 124,410
Werner
  • 603,163
  • “The quick fox jumped over the lazy dog” isn't a pangram. the conventional version has a “quick brown fox”, but i think there are other versions. – wasteofspace Feb 20 '14 at 09:18
  • @wasteofspace Even with brown, it's not a pangram. Either jump has to be in the present tense, or you need more than 1 dog. – Brent.Longborough Feb 20 '14 at 16:44
  • So there's no additional major drawbacks after all? – Gonzalo Medina Mar 03 '14 at 18:19
  • @GonzaloMedina: You've already mentioned another one in your original post: "If there isn’t enough space left on the page, the float is carried over to the next page together with whatever follows, even though there might still be room left for some of that." I think the consensus about [H] is that it goes against what floats should do... float. But, if well-used under these circumstances, there is no major drawback. – Werner Mar 03 '14 at 18:22
  • Yes, that's why I said "additional". I guess you're right; well used it can be helpful in some circumstances. – Gonzalo Medina Mar 03 '14 at 18:32
6

Another drawback is that using the H modifier for some floats might result in floats out of order, as the following example demonstrates:

\documentclass{book}
\usepackage{graphicx}
\usepackage{float}

\begin{document}

\chapter{A test chapter}

\begin{figure}
\centering
\includegraphics[width=4cm]{example-image-a}
\caption{A test floating figure}
\end{figure}

\begin{figure}[H]
\centering
\includegraphics[width=4cm]{example-image-b}
\caption{A test non-floating figure}
\end{figure}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • This should be mentioned in the documentation of float. On the other hand, the [H] specifier should never be used. ;-) – egreg Aug 31 '15 at 15:33
  • @egreg Yes, this should be mentioned in the documentation. I also agree that [H] shouldn't be used. – Gonzalo Medina Aug 31 '15 at 15:35