# Wrapfig places picture at end of document

I'm trying to use a wrap fig to place an image next to some text. But when it compiles the image gets placed at the very end of the document several pages away from where it is supposed to be.

The LaTeX source I am using is:

\begin{solution}
(b) No: Because the graph looks like:

\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics{4x4graph.png}
\end{center}
\end{wrapfigure}
The marked vertexes have odd degree.  As you draw a path the degree of the start and end vertex decrease by 1, and every vertex on the path in between decrease by 2.  This means that the only way to hit every edge, is for each of the odd degree vertices to be the start and end of a path, but as there are 5 strings, you can only start and end at 10 vertices and as there are 12 odd vertices  2 of them cannot be the start and end of a path, so it is not possible to make this graph.
\end{solution}

-
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – yo' Feb 23 '12 at 13:53
While attempting to create a small example of the problem I found that the problem seems to stem from being inside the "solution" environment. Is there a way to get around that, or should I just work with it now that I know how to avoid the problem – Gabrielle Feb 24 '12 at 1:32
As @tohecz stated earlier, please compose a complete compilable example that shows the problem. This needs to have the \documentclass (use article if you are not set on a class), and all the packages that are needed. For the graphicx you should use \usepackage[demo]{graphicx} so that the example can be compiled without the image: . – Peter Grill Feb 24 '12 at 3:57
@Gabrielle If solution is defined in terms of a list environment (which is the case if it's defined with ntheorem tools), then wrapfigure can't be used inside it. – egreg Mar 4 '12 at 16:24

If the solution environment is defined in terms of a list environment (which is the case if it's defined with ntheorem tools), then wrapfigure can't be used inside it and there's little one can do about it. Sorry.
If you want your picture to wrap a paragraph, put the wrapfig environment in front of it and leave some blank lines after the wrapfig environment in your source.