LaTeX warning "`h' float specifier changed to `ht'": cause and fix
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
\begin{figure}[h]or\begin{table}[h]is used, and the float is taller than the rest of the page.[!h]is used. The!relaxes some limits, but the float still has to fit on the page; the message then reads "!h float specifier changed to !ht".
How to fix it
- Give LaTeX more choices:
\begin{figure}[htbp]allows here, top of a page, bottom of a page and a page of floats. See Figure placement in LaTeX. - To fix the float exactly at its place in the text, load
floatand write\begin{figure}[H]. If it does not fit, the page break comes before it and leaves white space. - Make the float smaller, for example with
height=0.4\textheightin\includegraphics.
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
- How-to Figure placement in LaTeX
- Package
float - Error Float too large for page by 99.90506pt
- Error Too many unprocessed floats