4
\documentclass{article}
usepackage{xypic,wrapfig,enumitem}

\begin{document}

\begin{enumerate}
\item Let $X$ be an annulus surrounded by two concentric circles $C_1$ and $C_2$ and $C$ be any concentric circle lying completely in $X$. Show that the circle
$C$ is a strong deformation retract of $X$. Calculate $\pi_1(X)\cong \mb Z$
\begin{wrapfigure}{r}{0.2\textwidth}
\includegraphics[width=0.2\textwidth]{fig2.png}
\vspace{-.5cm}
\end{wrapfigure}
$[From the centre $O$ draw a half line in each direction. Each such line meets the circle $C$ in a unique point, $r(x)$(say). Let $r : X \rightarrow C$
be the mapping which maps all points of the half line to the corresponding point $r(x)$. Define $H : X \times I \rightarrow X$ by $H(x,t)=(1-t)x+tr(x)$.
 Then $H$ is a strong deformation retraction.
$]$
\end{enumerate}

\end{document}
cmhughes
  • 100,947
  • When I compile .tex file shows the following warnings. ./myfile.tex:964: wrapfigure used inside a conflicting environment on input line 964. ./myfile.tex:974:Stationary wrapfigure forced to float on input line 974. The output figure is not placed where I want to get it. It is printed on the outside of the 'enumeration'.I want to get the in the actual position. – Md Kutubuddin Sardar Mar 25 '13 at 02:12
  • 3
    wrapfigure and lists don't cooperate; for a possible work-around, see http://tex.stackexchange.com/q/59101/3954. – Gonzalo Medina Mar 25 '13 at 02:18
  • 2
    The code you posted won't compile without a \begin{enumerate} ... \end{enumerate} environment. But the first page of the wrapfig documentation says: "You must not specify a wrapfigure in any type of list environment or or immediately before or immediately after one. It is OK to follow a list if there is a blank line (\par) in between." So this will never work. – Alan Munn Mar 25 '13 at 02:19
  • Tell me whether there is an alternative way to include any figure in the list environment. – Md Kutubuddin Sardar Mar 25 '13 at 03:11

1 Answers1

6

None of the figure wrapping packages for LaTeX (wrapfig, picins, floatflt) work within lists. Supposedly LaTeX3 will fix that, but so far I have not seen any solution. If you are willing to switch to ConTeXt, though, this sort of stuff seems to work in ConTeXt perfectly fine. To have a figure on the left side, with text wrapping around it, all you do is

\placefigure[left] {caption} {content of the figure}

and if you want the figure to be on the right of the text, you replace left with right. It works fine with lists, and only thing you have to watch for is placing figures near page boundaries, where they could stick out into the bottom margin and possibly out of the page. More about figure placement in ConTeXt can be found on ConTeXt garden.

Here is your example rewritten in ConTeXt:

\starttext
\startitemize[n]
\item Let $X$ be an annulus surrounded by two concentric circles $C_1$ and
   $C_2$ and $C$ be any concentric circle lying completely in $X$. Show that
   the circle $C$ is a strong deformation retract of $X$. Calculate
   $\pi_1(X)\cong \mb Z$
   \placefigure[right]{}{\externalfigure[fig2.png][width=0.2\textwidth]}
   [From the centre $O$ draw a half line in each direction. Each such line
   meets the circle $C$ in a unique point, $r(x)$(say). Let $r : X \rightarrow
   C$ be the mapping which maps all points of the half line to the
   corresponding point $r(x)$. Define $H : X \times I \rightarrow X$ by
   $H(x,t)=(1-t)x+tr(x)$.  Then $H$ is a strong deformation retraction.]
\stopitemize
\stoptext

Compile it by running

context file.tex

where file.tex is the name of your file.

I normally use LaTeX for most of my documents, but every time I need to write a document that wraps text around figures, I use ConTeXt for that.

Aditya
  • 62,301
Jan Hlavacek
  • 19,242