13

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

1 Answer 1

13

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

6
  • Thanks. I knew the picins environment but not the cutwin one. Could these three tools be merged in a single one?
    – pluton
    Sep 30, 2012 at 4:04
  • @pluton You're welcome. What do you mean with merging the three tools in one? Sep 30, 2012 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, 2012 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. Sep 30, 2012 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, 2017 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .