Latex:文本不能放置在图像下方

发布于 2024-09-01 13:50:20 字数 787 浏览 8 评论 0原文

我在处理图像和一些文本时遇到问题。我有这个代码:

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*{})来“破解它”,但这会产生一些空白,看起来很奇怪。有什么建议吗?

I'm having a problem with an image and some text. I have this code:

Some text...\\

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

Some more text...

Basically, I want this:

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]

But, what the above code gives me is this:

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 insists on putting everything but a new section above the image even though its below the image in the code. Its probably because the image floats on top - but whats my alternative? There's not enough space on the first page to display the image there, to I cannot use [h] as the float-alignment.

I can "hack it", by creating an empty new section, like \section*{}, but this creates some white-space, which looks weird. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忱杏 2024-09-08 13:50:20

如果你确实需要在那个地方有图形,请使用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}
  \captionof{figure}[LOF entry]{The caption}   
  \label{fig:picture}
\end{center}

Some more text...

If you really need to have the figure in that place, use the float package:

In the preamble:

\usepackage{float}

then, in the text:

Some text...

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

Some more text...

Even though, is more preferable to let LaTeX place the floats.


Another way to do the same thing is by using the caption package.

In the preamble:

\usepackage{caption}

then, in the text:

Some text...

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

Some more text...
萝莉病 2024-09-08 13:50:20

使用 titleof 代替标题:
\usepackage{标题}

Some text...

\begin{center}
  \includegraphics[width=0.6\textwidth]{picture.jpg}
  \captionof{figure}{Caption contents}  
  \label{fig:picture}
\end{center}

Some more text...

Use captionof instead of caption:
\usepackage{caption}

Some text...

\begin{center}
  \includegraphics[width=0.6\textwidth]{picture.jpg}
  \captionof{figure}{Caption contents}  
  \label{fig:picture}
\end{center}

Some more text...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文