> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/zh-cn/wen-da/15-how-can-i-get-my-table-or-figure-to-stay-where-they-are-instead-of-going-to-the-next-page.md).

# 我如何让表格或图形留在当前位置，而不是移到下一页？

通常与 `\begin{figure}` 或 `\begin{table}` 即 *浮动体*，默认的放置标识符是 `[btp]`，这意味着 LaTeX 允许将图形放置在 \*\*`b`\*\*页面/栏底部； \*\*`t`\*\*页面/栏顶部；或者如果该浮动体很高（包括标题），则会单独放在一个浮动体 \*\*`页`\*\*面没有任何文字。这遵循专业排版和出版的惯例（即 TeX 被创造出来的用途），其中像图和表这样的“浮动材料”只允许出现在这些位置：如果它们被放在页面中间，就会被认为会打断阅读流。

不过，我们仍然可以影响希望图形出现的位置。如果你添加 `[hbt!]` 在……之后 `\begin{figure}`，如下所示：

```latex
\begin{figure}[hbt!]
```

这会告诉 LaTeX 将图片放在这里（尽可能靠近源代码中的位置）；如果这不可能（例如它太大，无法放入当前页），则放在下一页的顶部或底部。感叹号 **`!`** 很重要：它告诉 LaTeX “请务必尊重我在这里的选择”。

不过，如果你的图形很高，而当前页空间不足（例如它已经接近当前页末尾），那么该图形仍会被移到下一页顶部。在这种情况下，你可以尝试将你的 `\begin{figure}[hbt!]...\end{figure}` 代码向前移动几个段落，在那个位置当前页仍然有更多可用空间。

如果这仍然不起作用，而你的图形/表格已经继续浮动到下一 `\section` 个标题之后出现，那么你可能更希望它们仍然出现在当前小节末尾。然后你可以发出一个 `\clearpage` 在下一个 `\section` 来插入分页符，这也会在下一个 `\section` 标题在新页上打印出来。

或者，看看 [`placeins` 宏包](http://texdoc.net/pkg/placeins)，你可以在其中添加 `\FloatBarrier` 在下一个 `\section`——或者通过使用 `section` 包选项来自动实现，即写作 `\usepackage[section]{placeins}` 在导言区。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/zh-cn/wen-da/15-how-can-i-get-my-table-or-figure-to-stay-where-they-are-instead-of-going-to-the-next-page.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
