> 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/01-abovedisplayskip-and-related-commands.md).

# \abovedisplayskip 及相关命令

`\abovedisplayskip` 是用于控制 TEX 引擎在显示公式前后添加多少间距（弹性空白）的 4 个命令之一：

* `\abovedisplayskip[=]` *间距*
* `\belowdisplayskip[=]` *间距*
* `\abovedisplayshortskip[=]` *间距*
* `\belowdisplayshortskip[=]` *间距*

其中 *间距* 表示某种“弹性空白”，而“\[=]”表示一个 *可选的* “=” 可以跟在命令后面。

**用法示例** `\abovedisplayskip=12pt plus 3pt minus 9pt` （“=” 符号是可选的）。

上面的 4 个命令都可用于设置（存储）你偏好的间距值，供 TEX 在排版显示数学公式时使用。

#### 选择使用哪种间距

与大多数 TEX 算法一样，完整描述需要涉及 *许多* 细节，但， *粗略近似地说*，TEX 会检查段落最后一行与公式是否“重叠”：该比较的结果决定在公式上下放置哪种间距。实际上，TEX 还会测试是否存在公式编号。

如果公式前面是一行“足够短”的文本，则存储在 `\abovedisplayshortskip` 中的间距将插入到公式上方，而存储在 `\belowdisplayshortskip` 中的间距值将插入到公式后面。对于较长的行（或较长的公式），TEX 则会改为在公式上方插入间距 `\abovedisplayskip` ，以及 `\belowdisplayskip` 在公式下方插入。

关于 TEX 究竟如何选择在显示公式（`\abovedisplayskip` 或 `\abovedisplayshortskip`）上方或下方（`\belowdisplayskip` 或 `\belowdisplayshortskip`）放置哪种间距的详细说明，可见《The TEXbook》第 188–189 页。

#### 示例

为了演示，我们将为各种间距使用一些“极端”值，以便其效果清晰可见。我们将选择 `\abovedisplayshortskip=-20pt` 这将使显示公式 *向上移动* 20pt，如果该公式前面是一行足够短的文本。我们还将使用 `\belowdisplayshortskip=100pt` 来设置插入到显示公式下方的间距（100 pt）。这里，我们将以薛定谔方程为基础来说明这些命令的效果：

```
\[ \frac{\hbar^2}{2m}\nabla^2\Psi + V(\mathbf{r})\Psi
= -i\hbar \frac{\partial\Psi}{\partial t} \]
```

从而得到下面的数学式：

$$\frac{\hbar ^2}{2m}\nabla ^2\Psi + V(\mathbf{r})\Psi = -i\hbar \frac{\partial \Psi }{\partial t}$$ 下面的示例使用了上面提到的“极端”间距值：

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent 短的最后一行...
\[ \frac{\hbar^2}{2m}\nabla^2\Psi + V(\mathbf{r})\Psi
= -i\hbar \frac{\partial\Psi}{\partial t} \]
... 一行简短的结尾。
```

下图显示了结果：

![](/files/d87c8a61a75fd3b67a8fa5304efc5ab08c43f8e4)

如你所见，薛定谔方程已向上移动了 20pt，并在其下方增加了 100pt 的空白。

不过，如果我们现在使用一个宽得多的公式，并带有 `\abovedisplayshortskip=-20pt` 和 `\belowdisplayshortskip=100pt` ，或者增加段落最后一行的长度，那么这两个间距设置就会被忽略，因为显示公式与最后一行“重叠”了。此时，TEX 会改用间距 `\abovedisplayskip` ，以及 `\belowdisplayskip` 放在其下方。这里，我们没有为 `\abovedisplayskip` 或 `\belowdisplayskip` 设置数值，而是直接使用它们的默认值：

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent 短的最后一行...
\[\int_{x^2 + y^2 \leq R^2} f(x,y)\,dx\,dy
= \int_{\theta=0}^{2\pi} \int_{r=0}^R
f(r\cos\theta,r\sin\theta) r\,dr\,d\theta.\]
... 一行简短的结尾。
```

下图显示了结果：

![](/files/9c5d6e414e41faab214f01780317f789ca7f1659)

现在我们来排版薛定谔方程，但要确保最后一行更长：

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent 现在在我们的 Schr\&#x0022;{o}dinger 方程之前的是一行更长的文本。结果，
\TeX{} 将在公式上方使用 \verb|\abovedisplayskip| 间距，并在公式下方使用
\verb|\belowdisplayskip| 间距，而忽略我们提供的“极端”值：
\verb|\abovedisplayshortskip=-20pt| 和 \verb|\belowdisplayshortskip=100pt|。
\[ \frac{\hbar^2}{2m}\nabla^2\Psi + V(\mathbf{r})\Psi
= -i\hbar \frac{\partial\Psi}{\partial t} \]
... 一行简短的结尾。
```

下图显示了结果：

![](/files/2dca7e68f5cda990eb9b22b175ff125e6dca8662)

#### 相关命令

* `\displaywidth`\[=] *尺寸*
* `\displayindent`\[=] *尺寸*
* `\predisplaysize`\[=] *尺寸*

其中 *尺寸* 是一个以 TEX 可理解的单位表示的长度。“\[=]”表示一个 *可选的* 等号跟在命令后面。


---

# 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/01-abovedisplayskip-and-related-commands.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.
