1

I need to use the amsmath equation environment as the outer environment within which the inner aligned environment is used for 2 equations aligned at the = symbol. I did this to obtain a common/single equation number for both of these equations.

However, this leaves too much space above and below and looks too loosely typeset with respect to surrounding paragraphs. This is especially bad in my case since I need to use double-spacing.

I do not want to manually remove spaces by using \vspace commands. This is because I cannot figure out how much space needs to be removed if I need to change the font or convert the document from 12pt to 11pt etc (and I suspect it is not a good practice anyway).

I think the \SwapAboveDisplaySkip command from the mathtools package comes in handy. But the manual clearly says that it does not work with the amsmath equation environment. I nevertheless tried it and as expected, ran into errors such as

Misplaced \noalign.....

What would be a viable workaround for this scenario?

1

You have, from nccmath, \useshortskip. Contrary to \SwapAboveDisplaySkip, it has to placed before entering the environment:

\documentclass{article}
\usepackage{mathtools, nccmath}

\begin{document}

The discriminant of the cubic equation $\,x^3 + px + q = 0$ is
    \begin{equation}\Delta = 4p^3 + 27 q^2. \end{equation}

The discriminant of the cubic equation $\,x^3 + px + q = 0$ is \useshortskip
    \begin{equation}\Delta = 4p^3 + 27 q^2. \end{equation}

\end{document} 

enter image description here

  • Thank you. That does work indeed. But I see that nccmath is an old package and not really maintained anymore. Is there a modern replacement? – Krishna Apr 28 '18 at 14:09
  • I don't know really, but it's a package I use regularly, as it has some very handy macros (medium-sized fractions, in particular and an optional spacing argument for \intertext, in particular ). – Bernard Apr 28 '18 at 14:23
1

As far as I can tell equation with aligned inside will use the short above display skip when appropriate. If you really want access to \SwapAboveDisplaySkip to do this manually you can replace the outer equation by a gather:

Sample output

\documentclass{article}

\usepackage{mathtools}

\begin{document}
Some text before our equations to demonstrate vertical spacing is this
one context:
\begin{equation}
  \label{eq:x}
  \begin{aligned}
    a &= b\\
    c &= d
  \end{aligned}
\end{equation}
Some text before our equations to demonstrate vertical spacing is this
further context:
\begin{gather}
  \label{eq:y}
  \begin{split}
    a &= b\\
    c &= d
  \end{split}
\end{gather}
Some text before our equations to demonstrate vertical spacing is this
further context:
\begin{gather}
  \SwapAboveDisplaySkip
  \label{eq:y}
  \begin{split}
    a &= b\\
    c &= d
  \end{split}
\end{gather}

\end{document}

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.