> 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-tw/wen-yu-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`\*\*頁面/欄位底部；\*\*`的區域變數中`\*\*頁面/欄位頂部；或者如果浮動體相當高（包括標題說明），則會單獨放在一個浮動 \*\*`p`\*\*頁面而不附任何文字。這符合專業排版與出版（亦即 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-tw/wen-yu-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.
