LaTeX error "Float(s) lost": cause and fix
A margin note or a float was started in a place from which LaTeX cannot bring it onto the page, and it is gone. LaTeX only notices this when it finishes the page, so the line number in the message is not the line of the cause.
Why it happens
\marginparis used inside aminipageor a\parbox.\marginparor afigurestands inside a\footnote.\marginparstands inside afigureortable.\todofromtodonotesis used in one of these places. It sets its note with\marginpar.
How to fix it
- Search the page that was being built for
\marginpar,\todoand floats inside boxes, footnotes and floats. Commenting out half of the page at a time narrows it down. - Move the margin note out of the box, behind
\end{minipage}or behind the float. - Use
\marginnotefrommarginnote. It does not float and works inside aminipageand a footnote. - With
todonotes, write\todo[inline]{...}inside floats and footnotes.
A document that produces the message
\documentclass{article}
\begin{document}
\begin{minipage}{0.8\textwidth}
The result is 42.\marginpar{Check this.}
\end{minipage}
\end{document}The corrected document
\documentclass{article}
\usepackage{marginnote}
\begin{document}
\begin{minipage}{0.8\textwidth}
The result is 42.\marginnote{Check this.}
\end{minipage}
\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
- Error Not in outer par mode
- Error Marginpar on page 1 moved
- Package
marginnote - Package
todonotes