我使用该wrapfigure
包使文本环绕在图像周围。一切都很好,除了一件事:我想将其移到页面的较低位置,并在其前面放置几行(2 或 3 行)。在图像上,您会看到,段落的第一行“想要”将图像环绕在顶部,但做不到。
命令是:
Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here. Text here.
\begin{wrapfigure}[16]{o}{5cm}
\centering
\includegraphics[width=0.4\textwidth]{img01.jpg}
\captionsetup{labelsep=period}
\caption*{This is a figure caption.}
\end{wrapfigure}
\lipsum[1]
答案1
首先设置没有图像的文本,然后wrapfig
在自然换行发生的位置添加。
\documentclass[10pt,a4paper]{article}
\usepackage{wrapfig,graphicx}
\begin{document}
Text here. Text here. Text here. Text here. Text here. Text here. Text
here. Text here. Text here. Text here. Text here. Text here. Text
here.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id,
vulputate a, magna.%
\begin{wrapfigure}[12]{o}{5cm}
\centering
\vspace*{-10pt}
\includegraphics[width=0.4\textwidth]{example-image-a}
\caption{This is a figure caption.}
\end{wrapfigure}%
Donec vehicula augue eu neque. Pellentesque habitant
morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus
vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor
gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra
ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh
mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci
sit amet orci dignissim rutrum.
Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis
vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan
bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi
ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante.
Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis
parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla
ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris.
\end{document}
答案2
像这样:
代码:
\documentclass[10pt,a4paper]{article}
\usepackage{wrapfig2,lipsum}
\begin{document}
\lipsum[1][1-8]
\begin{wrapfigure}[12]{o}{5cm}
\centering
\vspace*{-10pt}
\includegraphics[width=0.4\textwidth]{example-image-a}
%\captionsetup{labelsep=period}
\caption{This is a figure caption.}
\end{wrapfigure}
\lipsum[1]
\end{document}