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.

this is my first stackexchange question so apologies for any bad etiquette.

I'm writing a document in double spacing. I don't wants the gaps between the lines of a multi-line equation to be that large, though.

I know that I can make this change globally by using

\setlength{\jot}{<size>}

...but this also affects other spacings that I don't want to change, e.g. in an xymatrix or when using \gather

I also know that I can keep the changes local by using

\begingroup\setlength{\jot}{<size>}\begin{split}
...
\end{split}\endgroup

...but there is a very large number of split equations in my document and I'd prefer not to make it even messier by doing this.

I tried to define a new environment to effect this local change, like so

\newenvironment{Split}%
{\begingroup\setlength{\jot}{-3pt}\begin{split}}%
{\end{split}\endgroup}

But when I try to implement this in the document I get the following error message:

LaTeX Error: \begin{split} on input line xxx ended by \end{Split}.

I've had success in defining new environments before so I don't know what I'm doing wrong this time.

MWE:

\documentclass{article}

\usepackage{setspace}
\doublespacing

\usepackage{amsmath}

\newenvironment{Split}%
{\begingroup\setlength{\jot}{-3pt}\begin{split}}%
{\end{split}\endgroup}

\begin{document}

\begin{equation}
\begin{split}
y&=x+x\\
&=2x
\end{split}
\end{equation}

\begin{equation}
\begin{Split}
y&=x+x\\
&=2x
\end{Split}
\end{equation}

\end{document}
share|improve this question
1  
Welcome to TeX.SX! –  Jubobs Sep 3 at 11:36
    
You don't need the \begingroup and \endgroup as they are provided by \newenvironment. In addition, if you replace \begin{split} with \split and \end{split} with \endsplit then your code at least compiles, but the spacing is unaffected. I'm not sure why the spacing is unaffected and I don't have time to investigate now. –  Andrew Sep 3 at 11:56
2  
See texdoc technote section 6... –  Andrew Swann Sep 3 at 12:11
1  
You may simply state \setlength{\jot}{-3pt} in the preamble: the length is used in all alignment environments. –  egreg Sep 3 at 12:21
    
@egreg I explained why I don't want to do that. –  mattghg Sep 3 at 12:56

2 Answers 2

up vote 6 down vote accepted
\documentclass{article}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{etoolbox}

\usepackage{lipsum} % just for the example
\usepackage[vmargin=2cm]{geometry} % just for the example

\doublespacing

\BeforeBeginEnvironment{split}{\linespread{1}\selectfont}{}{}

\begin{document}

\lipsum*[2]
\begin{equation}
\begin{split}
y&=x+x\\
&=2x
\end{split}
\end{equation}
\lipsum*[2]
\begin{align}
y&=x+x\\
&=2x
\end{align}
\lipsum*[2]
\begin{gather}
y=x+x\\
z=2x
\end{gather}
\lipsum*[2]

\end{document}

enter image description here

share|improve this answer

You can modify the \gather@split macro, calling \linespread{1}\selectfont before \spread@equation.

This won't affect other alignment environments.

\documentclass{article}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{etoolbox}

\usepackage{lipsum} % just for the example
\usepackage[vmargin=2cm]{geometry} % just for the example

\doublespacing

\makeatletter
\patchcmd{\gather@split}
  {\spread@equation}
  {\linespread{1}\selectfont\spread@equation}
  {}{}
\makeatother

\begin{document}

\lipsum*[2]
\begin{equation}
\begin{split}
y&=x+x\\
&=2x
\end{split}
\end{equation}
\lipsum*[2]
\begin{align}
y&=x+x\\
&=2x
\end{align}
\lipsum*[2]
\begin{gather}
y=x+x\\
z=2x
\end{gather}
\lipsum*[2]

\end{document}

enter image description here

share|improve this answer

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.