# Different spacing between single- and multi-line intertext in align

I currently have an issue when typesetting an align environment. I have a relatively long list of equations which should all be centered on a single character, but I want text in between the equations, hence my use of intertext. Since I'm forced by my college to use 1.5x line spacing, I use \usepackage[onehalfspacing]{setspace} for that.

The issue arises that depending on whether or not my \intertext has one or multiple lines, the vertical distance between the last equation before the text and the text itself seems to change.

It seems to be a function of what I use for the line spacing. With no line spacing command, the difference is almost negligible. With \usepackage[onehalfspacing]{setspace} or \linespread{1.22}, which are approximately equivalent for the text, this rises to 21% from the equations baseline to the baseline of the first line of the intertext.

Is there another command to introduce 1.5x line spacing which does not alter the spacing in correspondece to the number of lines in the intertext? Is there any way to force the vertical skips equal?

I used xpatch to patch the \xxxdisplay(short)skip to extremely low values to better show the difference in spacing.

Using two \intertexts for multi-line text, the spacing between equation and text is correct, but there's a huge gap between both text lines.

MWE:

\documentclass{scrreprt}

\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{xpatch}
\xapptocmd\normalsize{%
\abovedisplayskip=-5pt
\abovedisplayshortskip=-5pt
\belowdisplayskip=-5pt
\belowdisplayshortskip=-5pt
}{}{}

\usepackage[onehalfspacing]{setspace}

\begin{document}
\lipsum[1]
\begin{align*}
1 &= 1 \\
1 &= 1
\intertext{short intertext which will only span over one line}
1 &= 1 \\
1 &= 1
\intertext{longer intertext which will span more than one line demonstrating the vertical spacing issue adequately}
1 &= 1 \\
1 &= 1
\end{align*}
\end{document}

• Welcome to TeX.SE.I am not sure I see the problem in the output. But perhaps you are looking for \shortintertext? – Peter Grill Sep 6 '18 at 9:39
• Dear Peter, thank you for the welcome. The difference is indeed minute, I now adjusted the \xxxdisplayskip values to better show the point. There's a clear difference in space between the lower equation and the following text depending on line number. I've found an alternative which I'll add as an answer, but it comes with another disadvantage. – towe Sep 6 '18 at 9:47
• @PeterGrill Sorry, I wasn't aware of how you tag you before reading the introduction. – towe Sep 6 '18 at 13:17

You don't want those values of the display skips, but rather the nodisplayskipstretch option to setspace. You can choose between \intertext and \shortintertext.

\documentclass{scrreprt}

\usepackage{mathtools}

\usepackage[onehalfspacing,nodisplayskipstretch]{setspace}

\begin{document}

Some text which spans more than one line just to show
what happens; we want it to be quite long, so the line
above the display is not short
\begin{align*}
1 &= 1 \\
1 &= 1
\intertext{short intertext which will only span over one line}
1 &= 1 \\
1 &= 1
\intertext{longer intertext which will span more than one line demonstrating the vertical spacing issue adequately}
1 &= 1 \\
1 &= 1
\end{align*}
Some text which spans more than one line just to show
what happens; we want it to be quite long, so the line
above the display is not short
\begin{align*}
1 &= 1 \\
1 &= 1
\shortintertext{short intertext which will only span over one line}
1 &= 1 \\
1 &= 1
\shortintertext{longer intertext which will span more than one line demonstrating the vertical spacing issue adequately}
1 &= 1 \\
1 &= 1
\end{align*}

\end{document}


I've found a way to mitigate the issue - by not using \intertext

Using \noalign{\noindent foobar} results in even vertical spacing, independent of the number of lines.

This, however, comes with a disadvantage: \intertext reduces line spacing after a line break, presumably to better indicate that the text belongs together. I assume this is also the reason why the spacing above the first line is changed. This only happens when multiple lines are printed using \intertext, and explains why the issue becomes worse when increasing line spacing manually.

It would now be interesting to know whether there's a way to change line spacing during the noalign, but again only between lines, not before them.

MWE with fixed vertical spacing, but no reduced line spacing in the "intertext". Note the additional \\ before the line break, otherwise a misplaced \noalign would be thrown since you would try \noaligning an equation with an alignment character &:

\documentclass{scrreprt}

\usepackage{mathtools}
\usepackage{lipsum}
\usepackage{xpatch}
\xapptocmd\normalsize{%
\abovedisplayskip=-5pt
\abovedisplayshortskip=-5pt
\belowdisplayskip=-5pt
\belowdisplayshortskip=-5pt
}{}{}

\usepackage[onehalfspacing]{setspace}

\begin{document}
\lipsum[1]
\begin{align*}
1 &= 1 \\
1 &= 1 \\
\noalign{\noindent short intertext which will only span over one line}
1 &= 1 \\
1 &= 1 \\
\noalign{\noindent longer intertext which will span more than one line demonstrating the fixed vertical spacing issue adequately}
1 &= 1 \\
1 &= 1
\end{align*}
\end{document}