Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} 
share|improve this question
1  
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

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Actually I am using \text instead of \mbox precisely because it adjusts text size to super and subscripts! But I do not see how your answer explains the behaviour observed in my MWE!?? –  lpdbw Aug 15 '12 at 14:35
    
in the ams case the math display has smaller size (as it is using smaller fonts) so all the linespacing calculations are different. The actual formulas used are not changed by amsmath, it is just that the input to those formulae change. –  David Carlisle Aug 15 '12 at 14:38
    
OK, but 1) (loading amsmath) why does line spacing work properly with setstretch{1} and setstretch{1.05} but not with setstretch{1.15} and 2) is there any solution to the problem, I mean loading amsmath and using setstretch{1.15} and nonetheless having correct adjustment of line spacing so as to avoid super- and subscripts getting too close? –  lpdbw Aug 15 '12 at 14:43
    
annotated log output added to answer –  David Carlisle Aug 15 '12 at 15:06
    
Thanks. The edited answer is extremely informative!! Now I really understand how it works ;-) Is there any way to tell LaTeX that at a particular instance it should reserve more vertical space for an expression? The point is that I have this "problem" only in the symbol index where naturally symbols appear "one over the other". –  lpdbw Aug 15 '12 at 15:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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