LaTeX中浮动图像后如何清除?
我正在尝试在 LaTeX 中使用如下代码对浮动图像进行文本换行:
\begin{wrapfigure}{R}{0.5\textwidth}
\begin{center}
\includegraphics{images/image.png}
\caption{This is the caption.}
}
\label{fig:image1}
\end{center}
\end{wrapfigure
这在大多数情况下都可以正常工作(创建浮动在右侧的图像),但有时 LaTeX 在图像后无法正确清除,并为另一页或两页留下一个空栏。如何解决这个问题,或者理想情况下,LaTeX 是否具有类似于 CSS 中的 clear: Both
的功能?
有 \clearpage
命令,但当图像附近没有自然位置可以中断到新页面时,它并不合适。
I'm trying to text-wrap floating images in LaTeX, using code like the following:
\begin{wrapfigure}{R}{0.5\textwidth}
\begin{center}
\includegraphics{images/image.png}
\caption{This is the caption.}
}
\label{fig:image1}
\end{center}
\end{wrapfigure
This works fine most of the time (creating an image that floats on the right-hand side), but sometimes LaTeX does not properly clear after the image, and it leaves an open column for another page or two. How does one remedy this, or ideally, does LaTeX have a function similar to clear: both
in CSS?
There is the \clearpage
command, but it's not appropriate when there's no natural place to break to a new page near the image.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用 wrapfigure 的可选参数手动设置图形的高度
,其中 lineheight 是应环绕图像的文本行数。
You might try to manually set the height of the figure using the optional argument of wrapfigure
where lineheight is the number of text lines which shall wrap around the image.
对于这个问题我仍然没有一个好的答案,但目前的解决方案是根本不使用
wrapfigure
。仅使用figure
可以解决开列问题,但这并不是最理想的解决方案。仍然欢迎任何其他答案,但我将在这里为那些可能也需要它的人发布我的中途解决方案:I still don't have a good answer to this question, but the solution for now is to not use
wrapfigure
at all. Using onlyfigure
solves the problem of open columns, but it's not the most ideal solution. Any other answers are still welcome, but I'll post my half-way solution here for those who might also need it: