Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 597
user339860 Avatar asked Nov 29 '25 21:11

user339860


1 Answers

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

like image 76
Ulrich Schwarz Avatar answered Dec 01 '25 13:12

Ulrich Schwarz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!