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

# \abovedisplayskip and related commands

`\abovedisplayskip` is one of 4 commands to control the amount of glue (flexible space) that TEX engines add before, and after, a displayed equation:

* `\abovedisplayskip[=]` *glue*
* `\belowdisplayskip[=]` *glue*
* `\abovedisplayshortskip[=]` *glue*
* `\belowdisplayshortskip[=]` *glue*

where *glue* is some “flexible space” and the “\[=]” indicates that an *optional* “=” can follow after the command.

**usage example** `\abovedisplayskip=12pt plus 3pt minus 9pt` ( the “=” sign) is optional).

Each of the 4 commands above can be used to set (store) your preferred glue value that TEX can use when typesetting display mathematics.

#### Choosing which glues to use

As with most TEX algorithms, a full description needs to address *many* fine details but, *to a first approximation*, TEX checks whether the last line in the paragraph and the equation “overlap”: the outcome of that comparison determines which glue to place above and below the equation. In practice, TEX also tests for the presence of an equation number.

If the equation is preceded by a “sufficiently short” line the glue stored in `\abovedisplayshortskip` will be inserted above the equation and the glue value stored in `\belowdisplayshortskip` will be inserted after it. For longer lines (or longer equations), TEX will instead insert the glue `\abovedisplayskip` above the equation and `\belowdisplayskip` below it.

A detailed explanation of exactly how TEX chooses which glue to place above a display equation (`\abovedisplayskip` or `\abovedisplayshortskip`) or below it (`\belowdisplayskip` or `\belowdisplayshortskip`) can be found on pages 188–9 of The TEXbook.

#### Examples

For demonstration purposes, we’ll use some “extreme” values for the various glues so that their effect is clearly visible. We’ll choose `\abovedisplayshortskip=-20pt` which will moves a display equation *upwards* by 20pt if that equation is preceded by a sufficiently short line. We’ll also use `\belowdisplayshortskip=100pt` to set the glue (100 pt) inserted below the displayed equation. Here, we’ll use the Schrödinger equation as the basis for illustrating the effect of these commands:

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

which produces the following mathematics:

$$\frac{\hbar ^2}{2m}\nabla ^2\Psi + V(\mathbf{r})\Psi = -i\hbar \frac{\partial \Psi }{\partial t}$$ The following example uses the “extreme” glue values mentioned above:

```
\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} \]
... a short concluding line.
```

The following graphic shows the results:

![](/files/xakTl0mOjIIYv1H9VsWT)

As you can see, the Schrödinger equation has been shifted upwards by 20pt with 100pt of space added below it.

However, if we now use a much wider equation with `\abovedisplayshortskip=-20pt` and `\belowdisplayshortskip=100pt` or increase the length of the last line in our paragraph those two glue settings are ignored because the displayed equation “overlaps” the last line. Here, TEX now uses the glues `\abovedisplayskip` above the equation and `\belowdisplayskip` below it. Here, we have not set values for `\abovedisplayskip` or `\belowdisplayskip` but simply use their default values:

```
\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.\]
... a short concluding line.
```

The following graphic shows the results:

![](/files/iuFz4mtu1ADeORUadIQR)

Now we’ll typeset the the Schrödinger equation but make sure the last line is longer:

```
\abovedisplayshortskip=-20pt
\belowdisplayshortskip=100pt
\noindent A longer last line now precedes our Schr\&#x0022;{o}dinger equation. As a result,
\TeX{} will use the glues \verb|\abovedisplayskip| above the equation and
\verb|\belowdisplayskip| below it, ignoring the ‘‘extreme’’ values we supplied:
\verb|\abovedisplayshortskip=-20pt| and \verb|\belowdisplayshortskip=100pt|.
\[ \frac{\hbar^2}{2m}\nabla^2\Psi + V(\mathbf{r})\Psi
= -i\hbar \frac{\partial\Psi}{\partial t} \]
... a short concluding line.
```

The following graphic shows the results:

![](/files/nEQhFf9D1aXiLaAqB2Ki)

#### Related commands

* `\displaywidth`\[=] *dimension*
* `\displayindent`\[=] *dimension*
* `\predisplaysize`\[=] *dimension*

where *dimension* is a lenth in units understood by TEX. The “\[=]” indicates that an *optional* equals follows after the command.


---

# 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/tex-latex-primitives/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.
