2

I have a problem with the vertical space between align (1) and alignat (2). How can I reduce this space to the same vertical space as before (1)? How can I completely erase the vertical space? I know I can do this globally with abovedisplayskip and belowdisplayskip, but it doesn't work simply within these environments and I don't want to change anything globally.

Here is the MWE:

\documentclass[a4paper, 12pt, headsepline]{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{mathptmx}
\usepackage[a4paper]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm}


\begin{document}
Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text
\begin{align}
X_{t+1} &=  \frac{Z_{t+1}+X_{t+1}}{Y_M}  \\
N_{t}  &=  \frac{X_{t+1}+X_{t+1}}{T_{t+1}} \notag 
\end{align} 
% Reduce the vertical space here. Ideally to the same distance as from align to the above text, or whatever there is (eg other environments?)
\begin{alignat}{3}
&\text{as:} \quad & \gamma_{xyz} = \frac{a} {b} \qquad & \text{and}  & \qquad      \gamma_{zhk} = \frac{b}{a} \notag
\end{alignat}
Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text Text text
\end{document}

As you can see, there is an undesired, too big vertical space between align and alignat.

3

I wouldn't mess with it. It looks just fine if you put as: between the two environments:

\documentclass{scrreprt}

\usepackage{amsmath}

\begin{document}

\noindent Text before.
\begin{align}
  X_{t+1} &= \frac{Z_{t+1} + X_{t+1}}{Y_{M}}\\
  N_{t}   &= \frac{X_{t+1} + X_{t+1}}{T_{t+1}}\notag
\end{align}
as
\begin{equation*}
  \gamma_{xyz} = \frac{a}{b}
  \qquad \text{and} \qquad
  \gamma_{zhk} = \frac{b}{a}
\end{equation*}
Text after.

\end{document}

output

  • Ok I assume the space is not easy to change then? – TomM Dec 25 '13 at 18:46
  • 1
    @TomM If you absolutely want to, you can just use \vspace{<negative length>} between the environments. – Svend Tveskæg Dec 25 '13 at 18:54
9

when two separate display environments are set one after another, not separated by text, the spacing between them is the sum of \belowdisplayskip and the following \abovedisplayskip. since both have quite a large amount of stretch, this usually results in a much larger vertical space between them than desired.

it's better to combine them into a single gather environment, using subsidiary display environments such as aligned and alignedat to structure the separate parts. for example,

\begin{gather}
 \begin{aligned}
  X_{t+1} &=  \frac{Z_{t+1}+X_{t+1}}{Y_M}  \\
  N_{t}  &=  \frac{X_{t+1}+X_{t+1}}{T_{t+1}}
 \end{aligned} \\[6pt]
 \begin{alignedat}{3}
  &\text{as:} \quad & \gamma_{xyz} = \frac{a} {b} \qquad & \text{and}
  & \qquad      \gamma_{zhk} = \frac{b}{a} \notag
 \end{alignedat}
\end{gather}

a little extra vertical space between the two parts (here [6pt]) can be added.

in this case, it's not even necessary to use alignedat -- just straightforward math coding would suffice:

\text{as:\quad} \gamma_{xyz} = \frac{a}{b} \text{\qquad and\qquad}
                \gamma_{zhk} = \frac{b}{a}

even better would be to use \intertext for the initial text introducing that line:

\intertext{as:}
\gamma_{xyz} = \frac{a}{b} \text{\qquad and\qquad} \gamma_{zhk} = \frac{b}{a}

all within the enclosing gather. if \intertext is used, don't add the optional space between the parts; \intertext will take care of that.

  • This is a nice solution but if I have multiple labels within aligned, an error pops up: Multiple \label's: label x will be lost. I assume that is because of gather? – TomM Dec 25 '13 at 21:17
  • @TomM -- yes, aligned will provide only one label for the group. \intertext (if appropriate) is the best approach in that case. – barbara beeton Dec 25 '13 at 22:03
0

I also had the same problem (with subequations as well), I used this:

\setlength{\abovedisplayskip}{1pt}
\setlength{\belowdisplayskip}{1pt}

Nothing else seemed to be working smoothly. (this is not perfect, but was the only thing I found that actually worked rather nicely). You can adjust the {1pt} values based on the layout and view that you have. Just put it between aligns or alignats.

  • 1
    That's the content of what barbarabeeton already explained. And also the OP says he doesn't want to globally adjust those skips. – TeXnician Jun 21 '17 at 10:39
  • Yes, Barbara suggested gather. But if you have subequations, you won't be able to use _gather as there is a conflict between gather and subequations. Also, Barbara suggested to use some text, and again, you can't do anything if there's not text. I found this after several hours of testing and thought I would share (vertical spacing with subequations,align and alignat). Plus, if you put these two that I mentioned between align and alignat (inside the subequations), this is applied locally. – PeyM87 Jun 21 '17 at 13:42
  • Does the OP use subequations? – TeXnician Jun 21 '17 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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