> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/latex/zh-cn/tex-latex-yuan-yu/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/b7175877f4465e8f5b94dd9b19d2692b4ba46daa)

如你所见，已经在过满的末尾添加了一条 10mm 长的横线 `\hbox`。现在将 `\overfullrule=0mm` 设为以防显示过满盒子的横线：

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

下图显示了输出：

![](/files/73cb6a79077c436a369606dba9afc1c14f87e26e)

结果 `\hbox` 仍然过满，但这一次它在显示时没有过满横线来突出这一事实。

#### 另一个例子：段落中的各行

当 TEX 将一个段落断行成排版文本的各行时，段落中的每一行都会存储在一个 `\hbox`。可以通过设置 `\overfullrule` 为非零值来让 TEX 显示过满的各行。下面的示例展示了在段落中过满行末尾显示过满横线。

要创建一个段落，我们将把一些文本放入一个较窄的 `\vbox`，设置 `\overfullrule=10pt`，并给这个盒子画上边框。请注意，由于我们使用了 `\verb` 命令，我们首先需要将 `\vbox` 保存到一个盒子寄存器（100）中，然后使用 LATEX 命令（宏） `\fbox` 在其周围画一个紧贴的边框，这样更容易看到过满的各行。

```
\overfullrule=10pt
\setlength{\fboxsep}{0pt}% To ensure a tight border with no gap
\setbox100=\vbox{\hsize=30mm 在这个 vbox 中，我们将设置
行宽设为 30mm，使用 \verb|\hsize=30mm|。
我们正在 \verb|\vbox| 内排版一些文本
因为这会让 \TeX{} 进行断行
并将段落构造成一叠水平盒子。
对于某些行，\TeX{} 可能无法找到一个合适的
断行，这可能导致行宽过宽，无法适合
在 30mm 的宽度内。由于 \verb|\overfullrule|
非零（10pt），这些过满的行会
通过一个宽度为 10pt 的过满横线来标示。请注意，对 \TeX{} 来说，
即使
某些行并不适合，并且 \verb|\overfullrule|
这个宽度为 10pt 的横线也会被添加到某些行的末尾。}
\fbox{\copy100}
```

下图显示了输出：

![](/files/3c08f4842de271af7aaa3304914a35c447bf35bc)


---

# 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://ayakaleaf-pro.ayaka.space/latex/zh-cn/tex-latex-yuan-yu/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.
