如何在 '\begin{enumerate} \end{enumerate}' 内包含 wrapfigure?

如何在 '\begin{enumerate} \end{enumerate}' 内包含 wrapfigure?
\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}

答案1

LaTeX 的所有图形换行包(wrapfigpicinsfloatflt)均无法在列表中使用。据说 LaTeX3 会修复这个问题,但到目前为止我还没有看到任何解决方案。不过,如果你愿意切换到 ConTeXt,这类东西似乎在 ConTeXt 中工作得很好。要在左侧显示一个图形,并在其周围换行,你只需

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

如果您希望图形位于文本右侧,请将其替换leftright。它适用于列表,唯一需要注意的是将图形放置在页面边界附近,它们可能会伸出底部边距甚至超出页面。有关在 ConTeXt 中放置图形的更多信息,请访问康特克斯花园

以下是用 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

通过运行来编译

context file.tex

file.tex您的文件的名称是哪里。

我通常使用 LaTeX 来处理大多数文档,但每次我需要编写将文本环绕在图形周围的文档时,我都会使用 ConTeXt。

相关内容