10

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}
  • 4
    Yes, that's the reason. – egreg Sep 29 '12 at 16:18
9

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}

enter image description here

  • 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
  • 2
    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
  • Any other package besides cutwin, shapepar or wrapfig? I need something able to easily wrap text around non-rectangular shapes, without needing to define manually the coordinates for each line. – skan Feb 7 '17 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.