[Tex/LaTex] \wrapfigure makes the image to disappear

graphicswrapfigure

I try to add an image with text side by side. I've googled a lot and found that the most easy way is to use the package \wrapfigure.

Actually, it is a mathematical school exercise with the solution and the geometry shape. I don't know if it is important, but the exercise is part of an enumerate list. I don't know why, but my image isn't there when I build the code. If I remove the wrapfigure and leave without it, then it is there but in the end of the text.

Here is a MWE:

\begin{enumerate}
    \item ....  
    \item ....
    \item Here is some text...blah blah ... $E=E_1+E_2+E_3=2\cdot14+2\cdot3+2\cdot3=2\cdot(14+3+3)=2\cdot20=40$.

    \begin{wrapfigure}{r}{0.4\textwidth}
        \begin{center}
            \includegraphics[width=0.35\textwidth]{shape1.png}
        \end{center}
    \end{wrapfigure}
\end{enumerate}

Best Answer

This answer is based on David Carlisle's comment.

First, I turned your code into an MWE by adding the beginning and end of the file required to make it compile:

\documentclass{article}
\usepackage{graphicx}
% omit the package for wrapfigure as I'm not going to use it
\begin{document}
...
\end{document}

I also replace the image you used with tiger because this image is included in all standard TeX distributions.

Setting up the minipage environment, you'd put the image beside the text as follows:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
  \noindent
    \begin{minipage}{.6\linewidth}
      \begin{enumerate}
        \item ....
        \item ....
        \item Here is some text...blah blah ... $E=E_1+E_2+E_3=2\cdot14+2\cdot3+2\cdot3=2\cdot(14+3+3)=2\cdot20=40$.
      \end{enumerate}
    \end{minipage}
    \begin{minipage}{.4\linewidth}
      \centering
      \includegraphics[width=0.35\textwidth]{tiger}
    \end{minipage}
\end{document}

tiger lists