Equations and Double Spacing

If a document (in any class) is double spaced, how do you redefine the spacing around centered equations as if there was single spacing? Whenever I use double spacing, I feel like the space before and after a centered equations is too large.

-

If you are using the setspace package to change to doublespacing, you could use the etoolbox package and its \BeforeBeginEnvironment and \AfterEndEnvironment to append \begin{singlespace} before, and \end{singlespace} after the environments for displayed equations. The following example illustrates this approach for the equation and align environments (similar declarations will have to be made for the other environments and for their starred versions):

\documentclass{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{etoolbox}
\usepackage{lipsum}% just to generate text for the example

\BeforeBeginEnvironment{equation}{\begin{singlespace}}
\AfterEndEnvironment{equation}{\end{singlespace}\noindent\ignorespaces}
\BeforeBeginEnvironment{align}{\begin{singlespace}}
\AfterEndEnvironment{align}{\end{singlespace}\noindent\ignorespaces}

\doublespacing

\begin{document}

\lipsum[2]
$$a=b.$$
\lipsum[2]

\end{document}

-
What does \lipsum[2] mean? – richtera Mar 29 '12 at 1:07
@AlexRichter The lipsum package generates filler text; lipsum[2] means "use the second paragraph of the predefined text"; more generally, \lipsum[i-j] (with i<j) means "use the paragraphs i to j of the predefined text". – Gonzalo Medina Mar 29 '12 at 1:11
@AlexRichter: Mico's answer is better and you should accept it instead of mine. – Gonzalo Medina Mar 29 '12 at 2:47

You could simply set the nodisplayskipstretch option of the setspace package, viz., write

\usepackage[nodisplayskipstretch]{setspace}


in the preamble. An advantage of this solution is that it applies automatically to all display-math environments. (Aside: In the MWE below, the \namdui command serves to produce some filler text -- specifically, the first few sentences of the second stanza of the lipsum package's text.)

\documentclass{article}
\usepackage[nodisplayskipstretch]{setspace}

\newcommand{\namdui}{Nam dui ligula, fringilla a, euismod sodales,
sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus.}  % filler text

\doublespacing
\begin{document}

\namdui
$$a=b.$$
\namdui
\end{document}


-