2

The problem

I'm aware that LaTeX the spacing around equations in a paragraph differs depending on how long the line of the paragraph immediately preceding the equation is. When the preceding line is short, there's less vertical space before the equation, because the text of the equation will actually be below the empty part of the line. Thus, in plain text, we get something like:

  The quick brown fox jumps over the
lazy dog. The quick brown fox jumps.
                                       ; blank line before equation
              F = ma

  The quick brown fox jumps over the
lazy dog.                              ; no blank line before equation
              F = ma

That makes sense to me, but it seems that in the former case, the amount of space "looks" about the same, whereas in the latter case, the amount of space below the equation "looks" smaller. A screenshot and code for a minimal example follow.

Where is this behavior specified or documented, and what can I do to adjust it? In the minimal example, the difference doesn't really look bad, but it is noticeable, and in a document I'm working on it's very noticeable and doesn't look all that great. That document has a lot of non-minimal stuff (a package tree-style proofs that need to be wrapped in \vcenter, and double spacing), but I'm hoping that I can resolve this based on the example here.

Minimal working example

vertical spacing around equations

\documentclass{article}

\begin{document}

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.

The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

\end{document}

Illustration of the real, but non-minimal, problem

illustration of the real, non-minimal problem

  • 1
    You can adjust \abovedisplayshortskip - the length above a display equation that has a short line preceding it - if needed. – Werner Sep 1 '14 at 1:02
  • @Werner I actually want a bit more space below. I'm guessing there's a similar \belowdisplayshortskip (and I can search for that), but any idea why the difference seems so pronounced here? – Joshua Taylor Sep 1 '14 at 1:09
  • Oh, looking at this answer, I wonder if my real example is so bad as a result of the proof appearing "wider", and the system not being able to figure out that it could be raised a bit. – Joshua Taylor Sep 1 '14 at 1:11
  • 3
    Yes, there's \abovedisplayskip, \belowdisplayskip, \abovedisplayshortskip and \belowdisplayshortskip. – Werner Sep 1 '14 at 1:15
4

You seem to want that \belowdisplayshortskip is set equal to \belowdisplayskip; the former is used if the line above the display is “short”. The parameters are set in \normalsize (and also in \small and \footnotesize). Just append the appropriate declaration.

\documentclass{article}
\usepackage{etoolbox}
\appto\normalsize{\belowdisplayshortskip=\belowdisplayskip}
% the following two are not strictly necessary
\appto\small{\belowdisplayshortskip=\belowdisplayskip}
\appto\footnotesize{\belowdisplayshortskip=\belowdisplayskip}

\begin{document}

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.

\end{document}

enter image description here

  • @JoshuaTaylor If somewhere you say \small at the top level and \normalsize thereafter, the setting by \setlength won't hold any more. – egreg Sep 7 '14 at 22:37
  • Yeah, I commented too quickly and then said to myself, "I should read the documentation and experiment, first." Sorry for the noise. I'll probably accept this, as it does clearly solve the problem in the question. It's not having quite as nice an effect in the actual case (where there's doublespacing, and some tall "equations"), but I've having a rather hard time tracking down what makes the bad cases different. – Joshua Taylor Sep 7 '14 at 23:01
0

Making \belowdisplayshortskip the same as \belowdisplayskip

As Werner mentioned in a comment, the key to manipulating the spacing is in \abovedisplayskip, \belowdisplayskip, \abovedisplayshortskip and \belowdisplayshortskip. In my particular example, just setting the above short skip to be the same as the above normal skip gives nice results in my opinion. The difference is very pronounced when the text is doublespaced:

\documentclass{article}

\usepackage{setspace}
\doublespacing

\begin{document}

\section*{Ugly Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

\section*{Better Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
\end{document}

spacing before and after adjustment

Options with setspace

Since I'm actually using the setspace package, the answers to Equations and Double Spacing are relevant, too. The nodisplayskipstretch makes things a bit more similar, but not particularly pretty:

\documentclass{article}

\usepackage[nodisplayskipstretch]{setspace}
\doublespacing

\begin{document}

\section*{Ugly Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.

\section*{Better Spacing}
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the.
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\begin{equation}
  \frac{a}{b}
\end{equation}
The paragraph continues here.
The paragraph continues here.
The paragraph continues here.
\end{document}

with nodisplayskipstretch for setspace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.