> 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/tex-latex-ji-ben-ming-ling/07-overfullrule.md).

# \overfullrule

`\overfullrule[=]` *尺寸*

其中：

* “`[=]`” 表示等號是可選的。
* *尺寸* 是以 TEX 能理解的單位指定的數值——例如 pt、bp、mm 等。

當 TEX 偵測到一個 hbox 溢出時——例如排版段落中的一行，或某個文字位於一個 `\hbox{..}`——它會將該資訊寫入記錄檔。此外，TEX 引擎也提供 `\overfullrule` 命令，可用來指示 TEX 在造成問題的盒子末端加上一條短線，作為對使用者的視覺警告。

**使用範例**

由於「=」符號是可選的，你可以寫成 `\overfullrule=10pt` 或 `\overfullrule 10pt`.

請注意，LATEX 會將 `\overfullrule` 設為 0pt，而 Plain TEX 則將其設為 5pt。

#### 範例

我們將使用一個 `\hbox{}` 會溢出的： `\hbox to 10pt{This box will be overfull}` 並將 `\overfullrule` 設為非零值，例如 10mm：

```
\overfullrule=10mm\hbox to 10pt{This box will be overfull}\par
```

下圖顯示輸出：

![](/files/ac70af9baea903d3285b9b61992721b367226e20)

如你所見，一條長度為 10mm 的短線已加到溢出的 `\hbox`。現在將 `\overfullrule=0mm` 設為，以防顯示溢出盒子的短線：

```
\overfullrule=0mm\hbox to 10pt{This box will be overfull}
```

下圖顯示輸出：

![](/files/5a2dd3f53a60bd4669f09d071a906e89d7764b1b)

結果 `\hbox` 仍然是溢出的，但這次會在沒有溢出短線的情況下顯示，以突顯這一事實。

#### 另一個例子：段落中的行

當 TEX 將一個段落切分成排版文字的各行時，段落中的每一行都會儲存在一個 `\hbox`。可以透過設定 `\overfullrule` 為非零值來告訴 TEX 顯示溢出行。以下範例展示在段落中溢出行末端顯示溢出短線。

要建立一個段落，我們會將一些文字放進一個狹窄的 `\vbox`，設定 `\overfullrule=10pt`，並在盒子上畫上邊框。請注意，由於我們使用了 `\verb` 命令，我們首先需要將 `\vbox` 儲存在盒子暫存器（100）中，然後使用 LATEX 命令（巨集） `\fbox` 在其周圍畫出緊密的邊框，讓溢出的行更容易看見。

```
\overfullrule=10pt
\setlength{\fboxsep}{0pt}% 為了確保沒有間隙的緊密邊框
\setbox100=\vbox{\hsize=30mm 在這個 vbox 中，我們將設定
行寬為 30mm，使用 \verb|\hsize=30mm|。
我們正在一個 \verb|\vbox| 中排版一些文字
因為它會使 \TeX{} 進行斷行
並將段落建成一疊水平盒子。
對於某些行，\TeX{} 可能無法找到合適的
斷行，這可能導致行寬過大而無法容納
在 30mm 的寬度內。由於 \verb|\overfullrule| 是
非零值（10pt），那些溢出的行會
以寬度為 10pt 的溢出短線標示。請注意，對 \TeX{} 來說，
即使如此，這個盒子仍然被視為 30mm 寬，儘管
有些行無法容納，而且會加入一個 \verb|\overfullrule|
寬度為 10pt 的短線到某些行的末端。}
\fbox{\copy100}
```

下圖顯示輸出：

![](/files/0ad84ab7bb00f47636ec56d3644ec11de7e85580)


---

# 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/tex-latex-ji-ben-ming-ling/07-overfullrule.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.
