1

By setting abovedisplayskip and belowdisplayskip I can shrink the vertical space before and after displayed equations. (How to globally change the spacing around equations?) However, multline seems to have some extra space that I can't get rid of. How to control this (ever so slight) gap? Comparing equation and multline

\documentclass{article}
\usepackage{mathtools}

\begin{document} \setlength\abovedisplayskip{0pt plus 2pt minus 3pt} \setlength\belowdisplayskip{0pt plus 2pt minus 3pt}

\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. \texttt{equation}: \begin{equation} \begin{aligned} \smash{\Big|} a_{n+1} &= [2(n+1)][(n+1)^2-1]^{-1} = n^{-1} + (n+2)^{-1} \ &< (n-1)^{-1} + (n+1)^{-1} = (2n)(n^2 - 1)^{-1} = a_n. \end{aligned} \end{equation} Lorem ipsum dolor sit amet, consectetur adipiscing elit. \texttt{multline}: \begin{multline} \smash{\Big|} a_{n+1} = [2(n+1)][(n+1)^2-1]^{-1} = n^{-1} + (n+2)^{-1} \ < (n-1)^{-1} + (n+1)^{-1} = (2n)(n^2 - 1)^{-1} = a_n. \end{multline} Lorem ipsum dolor sit amet, consectetur adipiscing elit. \end{document}

Edit 1: Changed the MWE to something more realistic. Edit 2: Rewrote fractions to something not tall.

Mankka
  • 645
  • multline is meant for “multiple lines”. – egreg Mar 11 '22 at 15:24
  • @egreg Indeed it is, what I posted was only a MWE that exhibits the phenomenon. I usually begin with en equation, and when it spills over to the next line I have to decide whether to go with aligned nested within the equation, or multline or perhaps gather. This is a minor nuisance, I know, but from time to time it bothers me that the spacing changes if I switch from equation to multline. Do you agree that the spacing is different? – Mankka Mar 12 '22 at 19:33

1 Answers1

4

Both \begin{equation*}\begin{aligned}...\end{aligned}\end{equation*} and \begin{multline*}...\end{multline*} create display whose first line contains very tall items. This means that the normal \baselineskip is not used. Instead, \lineskip is used in addition to \abovedisplayskip.

In the former display, \lineskip is 1pt; in the latter display, \lineskip is increased to 4pt (the net increase of 3pt comes from \jot). If you want to cancel this net increase, you can say:

Lorem ipsum dolor sit amet, consectetur adipiscing
elit. \texttt{multline*}:% <- notice this comment sign here
\vadjust{\penalty\predisplaypenalty\vskip-\jot\relax}% <- magic!
\begin{multline*}
  \smash{\Bigg|} a_{n+1} = \frac{2(n+1)}{(n+1)^2-1}
  = \frac{1}{n} + \frac{1}{n+2}
  \\
  < \frac{1}{n-1} + \frac{1}{n+1}
  = \frac{2n}{n^2 - 1} = a_n.
\end{multline*}
Ruixi Zhang
  • 9,553
  • Indeed it is magic and indeed it works! Thank you! What is the role of the tall items in the first row? I removed all the tall items from my MWE. Can this be done globally or must it be done every time I use multline? – Mankka Mar 15 '22 at 07:42
  • 3
    @Mankka Thank you for pushing me to investigate this further. I'm now convinced that this is an amsmath bug and have filed a report to the LaTeX3 team (https://github.com/latex3/latex2e/issues/793). However, this bug will very likely never get fixed because the fix will break all existing documents from the past 40 years or so. For now, my recommendation is \newcommand*\fixmultline{\vadjust{\penalty\predisplaypenalty\vskip-\jot\relax}} and then use \fixmultline every time you use multline. – Ruixi Zhang Mar 15 '22 at 14:43
  • 1
    Amazing, thank you! Now, does this get me into the top ten of most fastidious LaTeX users? – Mankka Mar 15 '22 at 15:07
  • 1
    @Mankka Welcome to the club… for we shall forever spend way more time on getting the tiniest details right (which no one else will ever notice, probably) instead of actually being productive on writing papers. (This is meant to be a joke btw, :)) – Ruixi Zhang Mar 15 '22 at 22:14