# Strange interaction between amsmath and setspace

Compiling the MWE below, you will observe in the output the following phenomenon (you may have to zoom in):

• Comment amsmath out. Then, the spacing beteen lines is such that the subindex of the first line is not too close to the superindex of the second line, whatever the settings of setstretch.
• Now, load amsmath. Then, for \setstretch{1.0} and \setstretch{1.05} line spacing is again automatically adjusted so as to ensure that subindices of the first line do not get too close to superindices of the second line. BUT with \setstretch{1.15} the subindex of the first line almost overlaps the superindex of the second line.

Hope it's clear what I mean.

\documentclass{article}
\usepackage{setspace}\setstretch{1.0}
%\usepackage{setspace}\setstretch{1.05}
\usepackage{setspace}\setstretch{1.15}
%\usepackage{amsmath}
\begin{document}
XXXXXXXXXXXX $\Omega^{(\alpha,N)}_{\textup{brannnnnnnn}}$ XXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXX $\Omega^{(\alpha,N)}_{\textup{bran}}$ XXXXXXXXXXXXXXXXXXXXXXXXX
\end{document}

Am I having hallucinations or is there a strange behaviour?

PS: There are no such problems with the following code:

\documentclass{article}
%\usepackage{setspace}\setstretch{1.0}
%\usepackage{setspace}\setstretch{1.05}
\usepackage{setspace}\setstretch{1.15}
\usepackage{amsmath}
\begin{document}
XXXXXXXXXXXX $\Omega^{(\alpha,N)}_{\textup{bran}}$ XXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXX $\Omega^{N^{N^{N^N}}}_{\textup{bran}}$ XXXXXXXXXXXXXXXXXXXXXXXXX
\end{document}
-
Without amsmath, \lineskip` is used because the lines are too near to each other. This doesn't happen with amsmath that changes the behavior of \textup. – egreg Aug 15 '12 at 14:43

Add \showoutput and you will see that the \textup text changes from 10pt to 7pt, you have indirectly loaded amstext which makes \text.... commands respect subscript and reduce font size rather than acting like \mbox and always using the text size.

\documentclass{article}
\usepackage{setspace}\setstretch{1.0}
%\usepackage{setspace}\setstretch{1.05}
\usepackage{setspace}\setstretch{1.15}
\usepackage{amsmath}
\begin{document}

\showoutput
\showboxdepth3

XXXXXXXXXXXX $\Omega^{(\alpha,N)}_{\textup{brannnnnnnn}}$ XXXXXXXXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXX $\Omega^{(\alpha,N)}_{\textup{bran}}$ XXXXXXXXXXXXXXXXXXXXXXXXX
\end{document}

You will see in the log

...\hbox(10.44443+3.01659)x345.0, glue set - 1.0 []
...\glue(\parskip) 0.0 plus 1.0
...\glue(\baselineskip) 0.33891
...\hbox(10.44443+3.01659)x345.0, glue set 9.70201fil []

which means that the expression was just small enough to squeeze into the normal baseline spacing. the actual skip that TeX inserts between rows is \baselineskip minus the depth of one row and the height of the next, which is just 0.3pt here.

If you comment out amsmath you see

...\hbox(10.44443+5.09993)x345.0, glue set - 1.0 []
...\glue(\parskip) 0.0 plus 1.0
...\glue(\lineskip) 1.0
...\hbox(10.44443+5.09993)x345.0, glue set 9.70201fil []

so here the expression is too tall to fit in normal baseline spacing so at this point TeX inserts \lineskip glue which unlike \baselinesip is a fixed value (1pt here) inserted to stop lines colliding.

Normally it is considered good practice to maintain an even line spacing, even if that makes things get close on occasion. If it is too close then you can play with \lineskiplimit which is the minimum space allowed before TeX switches to adding \lineskip glue to separate the lines. This defaults to 0pt.

-