# wrapfigure in theorem-like environment

The following code does not create a wrapfigure within the thm environment. Is that because the latter is a list?

\documentclass{book}
\usepackage{amsthm}
\usepackage{wrapfig}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{thm}
\begin{wrapfigure}[7]{l}{2cm}
\rule{2cm}{2cm}
\end{wrapfigure}%
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\end{thm}
\end{document}

-
Yes, that's the reason. –  egreg Sep 29 '12 at 16:18
too bad but I'll try too find a workaround. –  pluton Sep 29 '12 at 16:19

The wrapfigure and wraptable environments don't work inside lists; the wrapfig documentation clearly mentions this fact:

The environment must not be placed in special places like lists.

You can use the cutwin package instead:

\documentclass{book}
\usepackage{amsthm}
\usepackage{cutwin}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\renewcommand\windowpagestuff{\rule{2cm}{2cm}}
\opencutleft
\begin{thm}
\begin{cutout}{2}{0pt}{\dimexpr\linewidth-2.5cm\relax}{6}
\lipsum[1]
\end{cutout}
\end{thm}
\end{document}


-
Thanks. I knew the picins environment but not the cutwin one. Could these three tools be merged in a single one? –  pluton Sep 30 '12 at 4:04
@pluton You're welcome. What do you mean with merging the three tools in one? –  Gonzalo Medina Sep 30 '12 at 4:06
my comment was probably useless. They (wrapfig, picins and cutwin) somehow all have their strengths and weaknesses. That'd be nice to have a single robust package that would decide what to do by itself but it is probably too difficult to implement. –  pluton Sep 30 '12 at 4:10
@pluton Ah, I see. Yes, I agree that a single package would be nice, but, besides technical difficulties, it also depends on someone taking the time and effort to take the best of the three approaches and writing the package. –  Gonzalo Medina Sep 30 '12 at 4:16