20

What is the difference between these two?

http://en.wikibooks.org/wiki/TeX/abovedisplayskip

http://en.wikibooks.org/wiki/TeX/abovedisplayshortskip

I don't know why, but it seems to work unusually.

\setlength{\abovedisplayskip}{5pt}
\setlength{\belowdisplayskip}{50pt}
\setlength{\abovedisplayshortskip}{2pt}
\setlength{\belowdisplayshortskip}{2pt} 

\begin{equation}
u_{i,t} = u_{i,t-1} + v_t
\end{equation}
\begin{equation}
u_{i,t-1} = u_{i,t-2} + v_{t-1}
\end{equation}
\begin{equation}
\Delta u_{it} = u_{i,t} - u_{i,t-1} = u_{i,t-1} + v_t - u_{i,t-1} =
v_t
\end{equation}

So why does it look like this:

the formulae

I expected the short display skip to be between consecutive formulae and the regular skip to be before and after the first and last in the series, or something like that. In any case, why the heck would it do this?

5 Answers 5

11

Others have well described when the "short" skips are selected; as to why, it's easy: the purpose is avoiding large gaps between text and a centered equation.

How to avoid unbalanced spacing before and after equations? The answer is simple: use amsmath that provides many environments in order to accommodate multiple equations or alignments. For example, your case study should be input as

\begin{gather}
u_{i,t} = u_{i,t-1} + v_t \\
u_{i,t-1} = u_{i,t-2} + v_{t-1} \\
\Delta u_{it} = u_{i,t} - u_{i,t-1} = u_{i,t-1} + v_t - u_{i,t-1} =
v_t
\end{gather}

which avoids the "unbalancedness" and also prevents bad page breaks. By default amsmath will never allow a display environment to be broken across pages, but it's possible to override locally this behavior at final revision time with a suitably placed \displaybreak command.

2
  • Thanks for that, amsmath works much better. Would you know how to set the spacing between environments and paragraphs? Oct 8, 2011 at 13:14
  • 2
    The environments honor the settings of \abovedisplayskip and friends.
    – egreg
    Oct 8, 2011 at 13:18
8

The short versions are used when the line above or below (as appropriate) is 'short'. Now, that leaves the question of what is 'short'. To quote the excellent TeX by Topic

The ‘short’ variants of the glue are taken if there is no \leqno left equation number, and if the last line of the paragraph above the display is short enough for the display to be raised a bit without coming too close to that line. In order to decide this, the effective width of the preceding line is saved in \predisplaysize. This value is calculated immediately after the opening $$ of the display has been scanned, together with the \displaywidth and \displayindent explained above.

Thus the short skips are used where there is a visual 'overlap' between the paragraph text and the math mode material.

1
  • The last sentence sounds incorrect: If there is overlap, the non-shorts should be used. Oct 31, 2020 at 15:18
7

I want to recommend the great work of Herbert Voß called mathmode (available on CTAN or simple texdoc mathmode).

He wrote on page 11

The short skips are used if the formula starts behind the end of the foregoing last line. Only for demonstration the shortskips are set to 0pt in the following examples and the normal skips to 20pt without any glue:

For more information please read this manual.

7

The short variants gets inserted when the previous/preceding paragraph is short, to compensate for the (optical) whitespace.

To paraphrase The TeXbook:

Let z, s, and p be the current values of \displaywidth, \displayindent, and \predisplaysize.

...

TEX computes a displacement d, to be used later when positioning box b,

...

If d + s ≤ p, or if there was a left equation number (\leqno), TeX sets g_a and g_b to glue items specified by the parameters \abovedisplayskip and \belowdisplayskip; respectively; otherwise, g_a and g_b become glue items corresponding to \abovedisplayshortskip and \belowdisplayshortskip. [Translation: If the predisplaysize is short enough so that it doesn't overlap the displayed formula, the glue above and below the display will be "short" by comparison with the glue that is used when there is an overlap.]

4
  • 2
    what defines a short paragraph? Oct 8, 2011 at 11:36
  • 1
    @Aram: A "short" paragraph is one with horizontal whitespace between the end of its last line and the start of the displayed equation.
    – lockstep
    Oct 8, 2011 at 11:44
  • Hmm. So there's no way to define a spacing before the first and last equation and another spacing in between equations? Oct 8, 2011 at 11:47
  • 7
    @AramKocharyan That's why one should never chain two equation environments, but rather use the environments provided by amsmath.
    – egreg
    Oct 8, 2011 at 12:04
1

The other answers explain what happens. Following a small example to play around with. The rules simulate the length of the first/last line of a paragraph. The optional argument lets you set the actual length.

\documentclass[%
%   fleqn% be careful, activating this deactivats shortskips
]{article}


\newcommand{\debugrule}[1][9]{%
\noindent \rule{.#1\linewidth}{10pt}
}
\setlength{\textwidth}{15em}
\begin{document}
\setlength\abovedisplayshortskip{0pt}
\setlength\belowdisplayshortskip{0pt}
\setlength\abovedisplayskip{50pt}
\setlength\belowdisplayskip{12pt}
\debugrule[1]
\[ \int \]
\debugrule[1]

\debugrule[1]
\[ \int \]
\debugrule[6]

\debugrule[5]
\[ \int \]
\debugrule

\debugrule[33]
\[ \int \]
\debugrule

\debugrule[34]
\[ \int \]
\debugrule
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .