LaTeX Error: Float(s) lost
A figure or table sits inside a footnote, a framed box or a similar construct LaTeX cannot place floats from, and it disappears. Move it into the text.
Help centre › LaTeX errors › Floats and layout · Error: the build stops or the output is wrong
What the log says
! LaTeX Error: Float(s) lost.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \end{document}What it means
LaTeX accepted a float somewhere it could not later put it on a page, and at the next page break the float was gone. The line number is where LaTeX noticed, often far below the float (even \end{document}), so search for floats inside footnotes, framed boxes and similar constructs.
Causes and fixes
Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.
1. A figure or table inside a \footnote
A footnote cannot hold a float. Put the figure in the main text and refer to it from the footnote with \ref.
\documentclass{article}
\begin{document}
Text.\footnote{See \begin{figure}\centering\rule{2cm}{1cm}\caption{Raw data.}\end{figure}}
\end{document}\documentclass{article}
\begin{document}
Text.\footnote{See Figure~\ref{fig:raw}.}
\begin{figure}\centering\rule{2cm}{1cm}\caption{Raw data.}\label{fig:raw}\end{figure}
\end{document}2. A float inside a framed, shaded or breakable box
Environments that can break across pages (framed, mdframed, breakable tcolorbox) typeset their content in a way that loses floats. Put the figure outside the box, or inside it without the figure environment, using \captionof from the caption package for the caption.
\documentclass{article}
\usepackage{framed}
\begin{document}
\begin{framed}
Key result.
\begin{figure}\centering\rule{2cm}{1cm}\caption{Raw data.}\end{figure}
\end{framed}
\end{document}\documentclass{article}
\usepackage{framed}
\begin{document}
\begin{framed}
Key result.
\end{framed}
\begin{figure}\centering\rule{2cm}{1cm}\caption{Raw data.}\end{figure}
\end{document}3. A \marginpar or \todo note inside a figure or table
A margin note is a float as well, and one inside a figure or table is lost with it. Move the note into the text next to the float.
\documentclass{article}
\begin{document}
\begin{figure}
\centering
\rule{3cm}{2cm}\marginpar{Check scale}
\caption{A sample.}
\end{figure}
\end{document}\documentclass{article}
\begin{document}
As shown in the figure.\marginpar{Check scale}
\begin{figure}
\centering
\rule{3cm}{2cm}
\caption{A sample.}
\end{figure}
\end{document}In Manulyx
The editor shows the error with an explanation; because the line is where LaTeX noticed, not where the float is, search the text above it for a float inside a footnote or box.
Write in Manulyx for free · Journal templates
More in floats and layout
- LaTeX Error: There's no line here to endA line break (\\ or \newline) comes where no line has started, typically after a blank line. Use \vspace or \medskip for vertical space.
- Overfull \hbox (<n>pt too wide) in paragraph at lines <a>--<b>A line sticks out into the margin because TeX found no acceptable place to break it: a long URL or word, or an image or equation wider than the column.
- Underfull \hbox (badness <n>) in paragraph at lines <a>--<b>A line had to be stretched more than TeX likes, leaving wide gaps between words. Usually caused by \\ or \linebreak in running text.
- LaTeX Warning: Float too large for page by <n>pt on input line <n>.A figure or table is taller than the text area, so it overprints the footer or runs off the page. Scale it to fit, or split a long table.
- Dimension too large.A length went past TeX's limit of about 16383pt (5.75 m). Usually a TikZ plot with large coordinates or a scale factor gone wrong.
- LaTeX Error: \caption outside float.\caption is used outside a figure or table environment. Wrap the content in figure or table, or use \captionof from the caption package.
Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors