This must be easy but I can't figure out why the "figure" is not put at the correct spot (in the example) with `wrapfigure'.
\documentclass{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{blindtext}
\newtheorem{example}{Example}[section]
\begin{document}
\begin{example}
\blindtext[1]
\begin{wrapfigure}{r}{0.5\textwidth}
\framebox[0.5\textwidth]{\rule{0pt}{100pt} Figure}
\end{wrapfigure}
\blindtext[1]
\end{example}
\blindtext[2]
\end{document}
