# Latex! not in outer par mode - includegraphics - figure

I'm getting that after certain number of figures, with few ones it works but went I add the last seven ones, I got this, please help.

Here is the structure of each figure, and here the link to the entire code: https://gist.github.com/stellamiranda/9358223

\begin{figure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insa280}
\caption{a280}
\label{fig:a280}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insberlin52}
\caption{berlin52}
\label{fig:berlin52}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insbier127}
\caption{bier127}
\label{fig:bier127}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insd1291}
\caption{d1291}
\label{fig:d1291}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insd198}
\caption{d198}
\label{fig:d198}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insd493}
\caption{d493}
\label{fig:d493}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insd657}
\caption{d657}
\label{fig:d657}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/insfl1400}
\caption{fl1400}
\label{fig:fl1400}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroA150}
\caption{kroA150}
\label{fig:kroA150}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroA200}
\caption{kroA200}
\label{fig:kroA200}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroB100}
\caption{kroB100}
\label{fig:kroB100}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroB150}
\caption{kroB150}
\label{fig:kroB150}
\end{subfigure}

\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroB200}
\caption{kroB200}
\label{fig:kroB200}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroC100}
\caption{kroC100}
\label{fig:kroC100}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroD100}
\caption{kroD100}
\label{fig:kroD100}
\end{subfigure}
\begin{subfigure}[b]{0.24\textwidth}

\includegraphics[width=\textwidth]{PlotsInstances/inskroE100}
\caption{kroE100}
\label{fig:kroE100}
\end{subfigure}

\caption{Algunas instancias de TSPLib}
\label{fig:Algunas instancias de TSPLib}
\end{figure}

• Welcome to SE TeX. Please post a Minimal Working Example which people can compile to demonstrate the issue. You can use images such as example-image-a in place of your own images to ensure others can use the code. Even if you cannot make it compile (if that's the problem), complete the code to get it as close to working as you can e.g. specify class, packages etc. which are needed. Certainly \includegraphics is not default and I doubt subfigure is, either. – cfr Mar 5 '14 at 0:06
• The error is saying that you have used figure somewhere it is not allowed, eg inside a box or a table. Your (over large) example code does not show the important part of the code that is causing the error: what is outside the figure (what is inside the figure is irrelevant to the question). – David Carlisle Mar 5 '14 at 0:13

On line 822 of the code you linked to, you have:

\begin{figure} % fl1400

\begin{figure} % kroA150


So you start a figure environment inside another and this produces the error (you cannot nest floats); remove the \begin{figure} from line 822. This will leave you now with a

! LaTeX Error: Too many unprocessed floats.


error, since LaTeX can't handle all those consecutive floats you are writing. Adding a \clearpage around line 822 will give you a compilable code.