Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

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]
\begin{equation}
a=b.
\end{equation}
\lipsum[2]

\end{document}
share|improve this answer
    
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
3  
@AlexRichter: Mico's answer is better and you should accept it instead of mine. –  Gonzalo Medina Mar 29 '12 at 2:47
    
It seems Mico's answer is not the same as this answer. Using nodisplayskipstretch does not make align environments singlespaced. However, this answer definitely does. –  Umang Jan 5 at 3:58
add comment

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
\begin{equation}
a=b.
\end{equation}
\namdui
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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