为什么文字没有环绕图像?

为什么文字没有环绕图像?

为什么 \lipsum 可以工作,但实际文本却不行?我希望能够输入自己的文本。

这个问题出自于没有得到这个答案上班。

非常感谢您的帮助。

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}% http://ctan.org/pkg/{graphicx,lipsum,wrapfig}
\begin{document}

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
\lipsum[1]
\endgroup

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac urna at eros tristique imperdiet et ut mauris. Maecenas semper commodo purus id egestas. Praesent at nisi non magna molestie varius ac sed arcu. Proin aliquet dui eget sapien venenatis rutrum. In vel eleifend tortor, eu sodales nulla. Vivamus sit amet posuere sem. Aliquam scelerisque ac mauris eu feugiat. Donec faucibus est in justo ullamcorper tincidunt. In hac habitasse platea dictumst. Ut et odio a orci eleifend iaculis. Praesent rhoncus auctor arcu eget vulputate. Sed commodo mi id quam hendrerit porttitor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
\endgroup
\end{document}

enter image description here

答案1

\lipsum定义以段落结尾,需要在前面留一个空行,如下所示\endgroup,或者更安全如果在文本剪切完成之前组有可能结束,则根本不要将 wrapfig 放在组中。

请注意,\columnsep 如果您有一个两列文档并且分页符恰好落在更改​​范围内,则在文档内进行更改将产生奇怪的效果。

enter image description here

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}% http://ctan.org/pkg/{graphicx,lipsum,wrapfig}
\begin{document}

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
\lipsum[1]
\endgroup

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac urna at eros tristique imperdiet et ut mauris. Maecenas semper commodo purus id egestas. Praesent at nisi non magna molestie varius ac sed arcu. Proin aliquet dui eget sapien venenatis rutrum. In vel eleifend tortor, eu sodales nulla. Vivamus sit amet posuere sem. Aliquam scelerisque ac mauris eu feugiat. Donec faucibus est in justo ullamcorper tincidunt. In hac habitasse platea dictumst. Ut et odio a orci eleifend iaculis. Praesent rhoncus auctor arcu eget vulputate. Sed commodo mi id quam hendrerit porttitor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\endgroup
\end{document}

答案2

归零设置\intextsep错误(尝试一下)。

最好定义自己的版本wrapfigure,而不是依赖文档中的代码重复。有必要使用\wrapfloat\endwrapfloat构建类似于标准环境的新环境。

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}

\newenvironment{lydiawrapfigure}
 {%
%  \setlength{\intextsep}{0pt}% <--- Wrong!
  \setlength{\columnsep}{15pt}%
  \wrapfloat{figure}%
 }
 {\endwrapfloat}

\begin{document}

\begin{lydiawrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{lydiawrapfigure}

\lipsum[1]

\begin{lydiawrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs2}
\end{lydiawrapfigure}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Nam ac urna at eros tristique imperdiet et ut mauris. 
Maecenas semper commodo purus id egestas. Praesent at 
nisi non magna molestie varius ac sed arcu. Proin aliquet 
dui eget sapien venenatis rutrum. In vel eleifend tortor, 
eu sodales nulla. Vivamus sit amet posuere sem. Aliquam 
scelerisque ac mauris eu feugiat. Donec faucibus est in 
justo ullamcorper tincidunt. In hac habitasse platea 
dictumst. Ut et odio a orci eleifend iaculis. Praesent 
rhoncus auctor arcu eget vulputate. Sed commodo mi id quam 
hendrerit porttitor. Class aptent taciti sociosqu ad litora 
torquent per conubia nostra, per inceptos himenaeos.

\end{document}

enter image description here

相关内容