如何防止文本在图形和表格之间爬行

mar*_*arw 6 text latex image

我对 LaTeX 中的浮点数有疑问,例如表格中的数字。在我的文档中,我有一段连续的图像和表格,这些图像和表格跨越几页。我希望本节不受以下章节的文本影响。但是,由于图片和表格并没有填满整个页面,所以在页面底部放置了一些文本行,这很烦人,因为文本与图像和表格无关。

浮动对象的定义如下:

\begin{figure}[!htb]
    \centering 
    \includegraphics[width=0.80\textwidth]{./img/img1.jpg}
    \caption{cap1}
\end{figure}

\begin{figure}[!htb]
    \centering 
    \includegraphics[width=0.80\textwidth]{./img/img2.jpg}
    \caption{cap2}
\end{figure}
Run Code Online (Sandbox Code Playgroud)

....

我想我必须在每个浮动部分的第一行中调整 [!htb] 参数,但我不确定以哪种方式。任何人的想法?

Wer*_*ner 5

在这种情况下,强制页面浮动似乎是合适的。此外,也许要在同一个浮点数中组合多个图像,但具有不同的\captions。是的,您可以在单个浮点数中包含多个\includegraphics\captions figure

在此处输入图片说明

\documentclass{article}
\usepackage{graphicx,lipsum}
\begin{document}

\section{A section}\lipsum[1]

\clearpage

\begin{figure}[p]
  \centering
  \includegraphics[width=.8\linewidth, height=.3\textheight]{example-image-a}
  \caption{A caption}

  \vspace{\floatsep}

  \includegraphics[width=.8\linewidth, height=.3\textheight]{example-image-b}
  \caption{Another caption}
\end{figure}

\begin{figure}[p]
  \centering
  \includegraphics[width=.8\linewidth, height=.3\textheight]{example-image-a}
  \caption{A caption}

  \vspace{\floatsep}

  \includegraphics[width=.8\linewidth, height=.3\textheight]{example-image-b}
  \caption{Another caption}
\end{figure}

\clearpage

\section{Another section}\lipsum[1-3]
\end{document}
Run Code Online (Sandbox Code Playgroud)

在上面的示例中,如果使用[!htb]浮点说明符,文本将写在浮点下方。\clearpage在开始新的部分内容之前,刷新所有挂起的浮动,将它们设置在自己的页面上。

有关可能影响它们的浮点数和参数的更多信息,请参阅文档(第6浮点布局,第 21 页;特别是图 13:浮点参数)。另外,请阅读如何影响LaTeXLaTeX等浮动环境的位置layouts figuretable