Search code examples
nestedlatexequation

Creating a newenvironment that contains nested environments


I have an issue in latex with the equation spacing. The document must be double spaced, but if the equations are double spaced there is too much vertical white space, especially in the matrices and vectors. I found a solution using setspace:

\begin{spacing}{1}
    \begin{align}
         equation
    \end{align}\\[12pt]
\end{spacing}

Where I need to use the \\[12pt] to adjust the spacing, because without it the equation sits right on top of the following text. To simplify matters, I wanted to create a new environment by using:

\newenvironment{myalign}%
    {\begin{spacing}{1}\begin{align}}%
    {\end{align}\\[12pt]\end{spacing}}

However I keep getting the an error: '\begin{align} ended by \begin{myalign} or similar. I found another post which explains why I get this error, but it is not obvious to me how to solve the problem.

Any help is greatly appreciated.


Solution

  • In this particular instance, replacing \begin{align} and \end{align} with \align and \endalign should work.