FatalDocument Structure
\caption Outside Float Environment
! LaTeX Error: \caption outside float.
What this error means
The \caption{} command was used outside of a floating environment (figure or table). Captions are part of float management and can only appear inside figure, table, or similar float environments.
Common causes
- \caption used directly in the document body without a surrounding figure or table
- The figure or table environment was accidentally closed before \caption
- \includegraphics used without a surrounding figure environment
How to fix it
Wrap the content and \caption in a figure or table environment. Always use \begin{figure}...\end{figure} around images you want to caption, and \begin{table}...\end{table} for tables.
Code examples
Causes the error
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{plot.png}
\caption{My plot} % Error: no surrounding figure
\end{document}Fixed
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\centering
\includegraphics{plot.png}
\caption{My plot}
\label{fig:plot}
\end{figure}
\end{document}Related errors
Test the fix live
Paste your LaTeX into the playground and compile instantly.

