1

In my paper, there are many inline equations with a large number of superscripts and subscripts. There is often no spacing between two lines.

The following is an example, which can occur in both the main text, caption, or algorithm float. The writing of math in the example may not be very good, but the focus of this issue is how to ensure a certain amount of spacing between two lines.

\documentclass{IEEEtran}
\usepackage{algorithm}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodss
$a_{\frac{f+b}{p+1}}$
tempor incididunt ut labore et dolore magna aliqasd a
$a^{\frac{1}{n+1}}$
proident, sunt in culpa qui officia
\begin{figure}
\caption{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodss
$a_{\frac{f+b}{p+1}}$
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
$a^{\frac{f+b}{p+1}}$
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
\end{figure}
\begin{algorithm}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodss
$a_{\frac{f+b}{p+1}}$
tempor incididunt ut labore et dolore magna aliqua
$a^{\frac{1}{n+1}}$
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{algorithm}
\end{document}

enter image description here

My requirement is to ensure that the spacing between the two lines is not less than a certain length, such as 1pt. My current approach is to set \lineskip, \normallineskip, \lineskiplimit and \normallineskiplimit to 1pt.

\ExplSyntaxOn
\clist_map_inline:nn
  { \lineskip, \normallineskip, \lineskiplimit, \normallineskiplimit }
  { \setlength { #1 } { 1pt } }
\ExplSyntaxOff

enter image description here

I have two questions:

  1. I would like to ask if there are any side effects of my actions. I have searched and learned some answers on tex.sx, but I am worried that it may have a negative effect on some areas.

  2. When I read the source code of IEEEtran.cls, I found that these are set to 0pt, while \lineskip and \normallineskip are 1pt, \lineskiplimit and \normallineskiplimit are 0pt in article.cls. Why the author of IEEEtran.cls designed it this way.

% if things get too close, go ahead and let them touch
\lineskip            0pt
\normallineskip      0pt
\lineskiplimit       0pt
\normallineskiplimit 0pt
2
  • Just set \normallineskip to 1pt. Why did the designers of IEEEtran set it to zero? Who knows?
    – egreg
    Apr 17, 2023 at 8:26
  • @egreg To my knowledge, when entering some environments or commands, \normallineskip will be assigned a value to \lineskip and take effect, such as minipage. If the lineskip is not set, the line spacing in the main text will not take effect. if things get too close, go ahead and let them touch mentioned by the IEEEtran author is somewhat puzzling. Expect someone to know why.
    – Clara
    Apr 17, 2023 at 10:36

1 Answer 1

2

see also https://tex.stackexchange.com/a/549219

The default values in latex (inherited from plain) are slightly odd, \lineskiplimit is 0pt so lines can get arbitrarily close, but \lineskip is 1pt so if 0pt is reached there is a discontinuity and a 1pt lineskip is inserted.

It would be more consistent to make them all 0pt (as you show ieee does) or all 1pt (as you suggest using).

Note even small negative values of \lineskiplimit do not (on average) cause over-printing as they just allow a tall item somewhere on one line to overlap a large depth somewhere on the line above, so you may choose to maintain baseline spacing but check for this in the log, and adjust wording if necessary.

Note typographers (and tex) would go to some lengths to maintain even baselines, so any use of \lineskip is essentially a failure. This is why inline math sets limits as subscripts, uses more cramped superscripts, smaller integral signs... So you could avoid the problem by adjusting the notation, perhaps using a/b rather than \frac{a}{b} in subscripts.

3
  • Thank you very much. I think I have figured it out and can use it with confidence. Additionally, I agree with what you said that the fractions in the superscript and subscript should be adjusted. However, in the example in question, the subscript fraction is only used to demonstrate that in reality, it may be some other higher symbol.
    – Clara
    Apr 17, 2023 at 10:32
  • @Clara sure but some (human) editors would push you to use displayed equation, or change notation or globally increase line spacing rather than change spacing for one line. But there is no hard right or wrong here.... Apr 17, 2023 at 10:42
  • Yes, it is generally more appropriate to place complex formulas between lines. However, it still appears that the first line is subscript and the second line is superscript, resulting in this part almost adjacent and very unattractive. Adding the distance setting mentioned earlier would make it much better. The main purpose of asking questions is that these lengths will be called at the lower level, fearing unexpected effects. Now I can confidently add 1pt.
    – Clara
    Apr 17, 2023 at 11:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .