# wrapfigure error

I'm using memoir (a beautiful documentclass that gets me in trouble too often)... and I'm trying to use wrapfigure.

This is what I use:

\documentclass[a4paper,oneside,12pt,openright,final,oldfontcommands]{memoir}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{./Images/13-SubdivisionRule}{o}{width=0.5\textwidth}
\caption[Shape Grammar Subdivision]{The subdivision of a surface by shape grammars for fabrication of the sheets \cite{shelden02}}
\label{SubdivisionSG}
\end{wrapfigure}

\end{document}


This is the error I get:

Package wrapfig Warning: wrapfigure used inside a conflicting environment on in
put line 129.

-
The code you just posted won't produce the warning mentioned; it will produce an error since the wrapfigure environment is being used in the wrong way (see my answer). –  Gonzalo Medina May 12 '12 at 20:44

You are using wrapfigure in the wrong way; the syntax for this environment is

\begin{wrapfigure}[<number of lines>]{<placement>}[<overhang>]{<width>}
<figure commands>
\end{wrapfigure}


so, you you can use something like the following:

\documentclass[a4paper,oneside,12pt,openright,final,oldfontcommands]{memoir}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{o}{0.5\textwidth}
\includegraphics{./Images/13-SubdivisionRule}
\caption[Shape Grammar Subdivision]{The subdivision of a surface by shape grammars for fabrication of the sheets \cite{shelden02}}
\label{SubdivisionSG}
\end{wrapfigure}

\end{document}


If you are getting the warning

Package wrapfig Warning: wrapfigure used inside a conflicting environment on input line 129.


then most probably you are using wrapfigure inside a list-like environment (enumerate, or itemize, for example) and the use of the environment is not allowed inside lists.

-
Works now. Although I can't control it's position at all, no matter where I put the environment in the file it appears at the end. –  Ayman Elmasry May 12 '12 at 20:51
@AymanElmasry: this advice is given in the package documentation: "It is possible that a non-floating wrapfigure will be forced to float when an earlier one is still being processed. A warning will be written in that case. You can have more information about the floating process written to the log file by specifying \usepackage[verbose]{wrapfig}". So check your .log file for any messages/warnings about wrapfigure. –  Gonzalo Medina May 12 '12 at 21:09