![列表内不支持换行图](https://linux22.com/image/373302/%E5%88%97%E8%A1%A8%E5%86%85%E4%B8%8D%E6%94%AF%E6%8C%81%E6%8D%A2%E8%A1%8C%E5%9B%BE.png)
大家好!。我在列表内使用换行图时遇到了挑战。请告诉我如何解决这个问题。
梅威瑟:
\documentclass{book}
\usepackage{wrapfig}
\usepackage[no-math]{fontspec}
\usepackage{graphicx,epstopdf}
\begin{document}
\begin{enumerate}
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\begin{wrapfigure}[12]{r}{12pc}%
\caption{This is a sample Caption}
\includegraphics{c01f002}
\end{wrapfigure}
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\end{enumerate}
\end{document}
答案1
这是一个使用insbox
纯 TeX 宏包和来自 的resume
和rightmargin
键的解决方案enumitem
。
一般的想法是在您想要插入图形文件(和插入图像)的地方停止列表,以略大于图像宽度的右边距恢复列表,然后在放置图像及其标题所需的项目数之后再次停止列表,最后以默认参数结束列表。
\documentclass[demo]{book}
\usepackage[no-math]{fontspec}
\usepackage{wrapfig}
\usepackage{graphicx, epstopdf}
\usepackage{enumitem}
\usepackage{caption}
\input{insbox.tex}
\begin{document}
%\InsertBoxR{2}{\includegraphics[width =12pc]{c01f002}}
\begin{enumerate}[after = \vspace*{-\topsep }]
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\end{enumerate}
\InsertBoxR{1}{\parbox{12pc}{\includegraphics[width =12pc]{c01f002}\captionof{figure}{This is a sample Caption}}}
\begin{enumerate}[resume*, rightmargin=13pc, before = \vspace*{\dimexpr\itemsep- \topsep}, after = \vspace*{-\topsep }]
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\end{enumerate}
%
\begin{enumerate}[resume*, before = \vspace*{\dimexpr\itemsep- \topsep-\baselineskip}]
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\item How fast will the electron be travelling when it hits the positive plate, if it left the negative plate with zero velocity?
\item How much energy does the electron gain as it moves from the negative plate to the positive plate?
\end{enumerate}
\end{document}