【问题标题】:Latex: Text cannot be placed below image乳胶:文字不能放在图像下方
【发布时间】:2011-02-19 03:42:43
【问题描述】:

图片和一些文字有问题。我有这个代码:

Some text...\\

\begin{figure}[ht]
\centering
\includegraphics[scale=0.75]{picture.jpg}
\caption{The caption}   
\label{fig:picture}
\end{figure}

Some more text...

基本上,我想要这个:

Some text. (Above image in the code)
[end of page / new page]
image
Some more text. (Below the image in the code)
[start of new section]

但是,上面的代码给我的是这样的:

Some text. (Above image in the code)
Some more text. (Below the image in the code)
[end of page / new page]
image
[start of new section]

Latex 坚持将所有内容都放在图像上方,即使它位于代码中的图像下方。可能是因为图像浮在顶部 - 但我的替代方案是什么?第一页上没有足够的空间来显示图像,我不能使用 [h] 作为浮动对齐。

我可以“破解”它,通过创建一个空的新部分,如\section*{},但这会产生一些空白,这看起来很奇怪。有什么建议吗?

【问题讨论】:

  • 你真的需要这样做吗?我的意思是,LaTeX 在管理浮动和交叉引用方面非常出色,这是实现漂亮排版和漂亮页面布局的主要功能之一......
  • 这是题外话。应该尽快转移到TEX Exchange

标签: layout latex figure text-alignment


【解决方案1】:

如果您真的需要在那个地方放上图,请使用float 包:

在序言中:

\usepackage{float}

那么,在正文中:

Some text...

\begin{figure}[H]
  \centering
  \includegraphics[scale=0.75]{picture.jpg}
  \caption{The caption}   
  \label{fig:picture}
\end{figure}

Some more text...

尽管如此,让 LaTeX 放置浮动更可取。


做同样事情的另一种方法是使用caption 包。

在序言中:

\usepackage{caption}

那么,在正文中:

Some text...

\begin{center}
  \includegraphics[scale=0.75]{picture.jpg}\\
  \caption{figure}[LOF entry]{The caption}   
  \label{fig:picture}
\end{center}

Some more text...

【讨论】:

  • 谢谢,它有效!我如何让乳胶放置花车?如果我不添加 [ht] 或我想要的任何浮点数,它只会将图像放在文档的末尾。我把图像放在一个奇怪的地方吗?你会把它放在哪里?
  • 最好使用两个放置选项: [tb] 用于小图形,与单页上的文本保持一致;否则,对于大数字,请使用 [p]。使用 package placeins 可以实现对浮动位置的更多控制
  • 酷,我不知道这些。 [tb] 似乎将图像准确地放置在逻辑上应该放置的位置,所以这似乎正是我想要的。
猜你喜欢
  • 2010-09-12
  • 1970-01-01
  • 2019-10-07
  • 2017-10-06
  • 1970-01-01
  • 2012-06-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-29
相关资源
最近更新 更多