How to put figure between items on enumerate list?

Augusto picture Augusto · Jun 22, 2018 · Viewed 13.4k times · Source

I've a enumerate list and some items have figures. I write this:

\begin{enumerate}
    \item Estado da arte: 
    \item Levantar os requisitos
    \item Com o microcontrolador
\ref{figurametodo3}.    
    \begin{figure}[h!]
        \begin{center}
            \includegraphics[scale=0.6]{./dados/figuras/metodo_3}
            \caption{Sistema para leitura da identificação de uma Tag} 
            \label{figurametodo3}
        \end{center}
    \end{figure}


    \item Estudar

    \begin{figure}[h]
    \begin{center}
        \includegraphics[scale=0.4]{./dados/figuras/metodo_4}
        \caption{Comunicação entre o microcontrolador e o celular} 
        \label{figurametodo4}
    \end{center}
\end{figure}

    \item Desenvolver 

    \begin{figure}[h]
    \begin{center}
        \includegraphics[scale=0.6]{./dados/figuras/metodo_final}
        \caption{Comunicação entre celulares e servidor} 
        \label{figura22}
    \end{center}
\end{figure}

\end{enumerate}

But it aligns all figures below the list, outside of place that I want. I want that my figures stay just below that your item. Inside of the list.

Answer

Werner picture Werner · Jun 26, 2018

This is covered in the following FAQs:

Here's one option using the float package and it's [H]ERE float specifier:

enter image description here

\documentclass{article}

\usepackage{float,graphicx}

\begin{document}

\begin{enumerate}
  \item Item 1
  \item Item 2
  \item Item 3

  \begin{figure}[H]
    \centering
    \includegraphics[width = .5\linewidth]{example-image-a}
    \caption{A figure caption}
  \end{figure}

  \item Item 4

  \begin{figure}[H]
    \centering
    \includegraphics[width = .5\linewidth]{example-image-b}
    \caption{B figure caption}
  \end{figure}

  \item Item 5
  \item Item 6
\end{enumerate}

\end{document}