# Avoid large spaces between text and equations

I use the options

\renewcommand{\baselinestretch}{1.25}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}


in the preamble of my document and most of the time the document looks like intended. Once in a while though, especially when I use multiline-equations, I get huge spaces right before and after the equation and the surrounding text, for example:

Is there any way I can avoid that without removing the \parskip option?

-
Do you have a blank line before and after the equation? If so, remove it (see also tex.stackexchange.com/questions/565/…). –  Caramdir Jun 27 '11 at 9:21
Also, this might be a problem with the page breaking. Do you have some big unbreakable block (e.g. a multiline equation) at (or near) the top of the following page)? If so, you could try if you like typesetting with \raggedbottom better. –  Caramdir Jun 27 '11 at 9:25
Yes you are correct: the problem was caused by a big unbreakable block on the next page. I also didn't know about the \raggedbottom option. Thanks! –  Christian Jun 27 '11 at 14:47

This might be a problem with the page breaking. Do you have some big unbreakable block (e.g. a multi-line equation) at (or near) the top of the following page)? If so, you could try to allow pagebreaks in that equation, convert the unbreakable block to a float, or maybe use \raggedbottom (which tells LaTeX not to ensure that every page has the same height).

-
Thanks! Is it possible to limit the range of \raggedbottom option to a particular page, such that LaTeX only assumes a different height for the page with the above equation? –  Christian Jun 27 '11 at 20:57
@Christian: I don't know. Best ask a new question. –  Caramdir Jun 27 '11 at 22:22
@Christian, you could do it by using the afterpage package, and defining \def\oneraggedpage{\raggedbottom\afterpage{\flushbottom}}. @Caramdir is right; this belongs as its own question, though, since it's independently useful. –  Ben Lerner Jun 29 '11 at 20:24

The spacing above and below math blocks is also controlled by \abovedisplayskip/\belowdisplayskip and \abovedisplayshortskip/\belowdisplayshortskip. Being skips, they can have some amount of stretch, which sometimes explains the (to my eye) surprising gaps between text paragraphs and math --- there's extra vertical stretchability that I didn't expect. Also, since the above and below versions may not be equal, they may stretch differently, leading to asymmetric spaces around the math.

In my current thesis style file, the default values are set at

Above:     10.0pt plus 2.0pt minus 5.0pt,
Aboveshort: 0.0pt plus 3.0pt,
Below:     10.0pt plus 2.0pt minus 5.0pt,
Belowshort: 6.0pt plus 3.0pt minus 3.0pt


(Note that Aboveshort != Belowshort; I have no idea why this is typographically right...) I don't quite understand when the "short" versions are used instead of the full versions, but I have found that always setting both pairs in tandem works well for me.

-
You may want to have a look at this question of mine to better understand the shortskip settings. –  Hendrik Vogt Jun 13 '12 at 14:18

Try \vspace{<dist>} with <dist> a negative value, right before the equation. Maybe not very elegant, but works with almost everything, figures, tables, you name it.

-
This did not work for me. –  Enthusiastic Student Oct 16 at 16:52

One can also try \allowdisplaybreaks

-
Welcome to TeX.sx! Thanks for your contribution. Answers should normally be a little bit more verbose, e.g. hold a short description what the macro is doing exactly. –  Martin Scharrer Sep 14 '11 at 9:34