LaTeX Error: Not in outer par mode

A figure, table or \marginpar is inside a box, minipage, table cell or another float. Floats must be in the main text; put the box inside the float.

Help centre › LaTeX errors › Floats and layout · Error: the build stops or the output is wrong

What the log says

! LaTeX Error: Not in outer par mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.5 \begin{figure}

What it means

Floats (figure, table and their starred forms) and margin notes can only be placed from the main flow of text, because LaTeX moves them to another place on the page. Inside a minipage, \parbox, table cell, another float or a margin note they have nowhere to go, and LaTeX stops.

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 minipage or box

Turn it inside out: the float outside, the minipage (or box) inside it. For side-by-side panels, put two minipages inside one figure; for a caption without a float, use \captionof from the caption package.

Fails
\documentclass{article}
\begin{document}
\begin{minipage}{\linewidth}
\begin{figure}
\centering
\rule{3cm}{2cm}
\caption{A sample.}
\end{figure}
\end{minipage}
\end{document}
Fixed
\documentclass{article}
\begin{document}
\begin{figure}
\begin{minipage}{\linewidth}
\centering
\rule{3cm}{2cm}
\caption{A sample.}
\end{minipage}
\end{figure}
\end{document}

2. A figure or table inside a tabular cell

Placing figures side by side with a tabular whose cells hold figure environments fails the same way. Put one figure environment around the whole tabular, or use subfigures from the subcaption package.

Fails
\documentclass{article}
\begin{document}
\begin{tabular}{cc}
\begin{figure}\rule{2cm}{1cm}\caption{Left.}\end{figure} & Right
\end{tabular}
\end{document}
Fixed
\documentclass{article}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{cc}
\rule{2cm}{1cm} & \rule{2cm}{1cm}
\end{tabular}
\caption{Left and right.}
\end{figure}
\end{document}

3. A \marginpar or \todo note inside a figure or table

A margin note is a float too, and cannot sit inside another float; depending on where it stands, LaTeX reports this error or "Float(s) lost". Move the note into the text next to the figure.

In Manulyx

The editor shows the error beside the float that cannot be placed, with an explanation.

Write in Manulyx for free · Journal templates

More in floats and layout

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors