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

# \abovedisplayskip 與相關命令

`\abovedisplayskip` 是控制 TEX 引擎在顯示方程式前後加入多少彈性間距（flexible space）的 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–9 頁找到。

#### 範例

為了示範起見，我們將為各種間距使用一些「極端」值，讓效果清楚可見。我們將選擇 `\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 A short last line...
\[ \frac{\hbar^2}{2m}\nabla^2\Psi + V(\mathbf{r})\Psi
= -i\hbar \frac{\partial\Psi}{\partial t} \]
... 一行較短的結語。
```

下圖顯示結果：

![](/files/d970ba909bc33df11368453018e3a6af5919db78)

如你所見，薛丁格方程式已向上移動 20pt，並在其下方增加了 100pt 的空白。

然而，如果我們現在改用一個更寬的方程式，並且有 `\abovedisplayshortskip=-20pt` 和 `\belowdisplayshortskip=100pt` 或增加段落最後一行的長度，這兩個間距設定都會被忽略，因為顯示方程式與最後一行「重疊」了。這裡，TEX 現在改用間距 `\abovedisplayskip` ，並在 `\belowdisplayskip` 下方。這裡，我們並未為 `\abovedisplayskip` 或 `\belowdisplayskip` 設定數值，而是直接使用它們的預設值：

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent A short last line...
\[\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/162a1a885c6bb0cfce92c44c19a0899825b963cc)

現在我們要排版薛丁格方程式，但要確保最後一行更長：

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent 一行更長的最後一行現在位於我們的薛丁格方程式之前。因此，
\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/1f8f4369b8f7546f91fb65cc821e69c2cbfcd478)

#### 相關命令

* `\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://overleaf-pro.ayaka.space/latex/zh-tw/tex-latex-ji-ben-ming-ling/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.
