LaTeX warning "`h' float specifier changed to `ht'": cause and fix

Warning `h' float specifier changed to `ht'

A float with the option [h] ("here") did not fit into the space left on the page. With h alone LaTeX would have no other place for it, so it added t, and the float goes to the top of a later page.

Why it happens

How to fix it

A document that produces the message

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Some text before the figure.
\begin{figure}[h]
\centering
\includegraphics[width=8cm,height=17cm]{image}
\caption{A tall figure}
\end{figure}
\end{document}

The corrected document

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Some text before the figure.
\begin{figure}[htbp]
\centering
\includegraphics[width=8cm,height=17cm]{image}
\caption{A tall figure}
\end{figure}
\end{document}

Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.

Finding the line in the editor

The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.

Related pages