during my optimization process I found something spurious I cannot explain to myself and which I would like to understand. So with \fontsize you set the fontsize and the baselineskip. However the behaviour of the second paramater is a bit unclear to me, because if you reduce it too much, at a certain point the baselineskip gets bigger again. Let me show you my example:



If you compile this, your result will be looking like this:

enter image description here

Now from the first to the third column it seems logic, that the baselineskip is reduced and hence less space is needed vertically to typeset. But with the third column, even though the baselineskip is reduced even further, it needs more vertical space overall. It is strange however, that for example from line 11 to 12 (starting with tus and lum), the spacing seems to be narrower than in column 3, while in a lot of line the spacing is bigger. Changing the baselineskip to lower values down to 0 does not modify the vertical alignment further.

What is the purpose of this behaviour and is it intended? I cannot see a benefit of this and I am a bit confused.

  • 1
    \fontsize isn't really involved here other than it sets \baselineskip, this is the TeX-primitive behaviour of vertical mode. – David Carlisle Jun 13 '20 at 12:38

enter image description here

If you add

 \lineskiplimit = -\maxdimen

you get the above.

TeX tries to maintain an even baseline spacing, as set by \baselineskip (which is set by the second argument of \fontsize and other places). However normally if the text in the lines is too large (say an inline math fraction) you do not want to maintain the even spacing and over-print the surrounding lines, so if the space that needs to be added gets below \lineskiplimit TeX gives up even spacing and just inserts the fixed space \lineskip between the lines. By default \lineskip is 1pt and \lineskiplimit is 0pt.

By setting a suitable large negative value for \lineskiplimit you can force even spacing even at the expense of over-printing.

In the last column you can see:

enter image description here

  • thanks for that explanation. What I don't get from it, taken my example: You say TeX adds \lineskip=1pt in those lines that are below \lineskiplimit, right? So if I am setting \baselineskip=8pt through \fontsize{10}{8}, my understanding would be that the vertical spacing could never be more than with 9pt baselineskip? What am I overlooking? – TobiBS Jun 14 '20 at 10:33
  • @TobiBS if you set baselineskip to 8pt but then insert a 5 row inline math matrix (or a \large accented capital or whatever) then (for normal values of \lineskiplimit) \baselineskip is ignored, fixed glue of `\lineskip (1pt) is added and then the box with the over-size line is added at its natural height. People do this all the time adding lareg images, then don't expect them to overlap and be laid down at 12pt intervals, they expect them to come one below the other. – David Carlisle Jun 14 '20 at 11:18
  • @TobiBS also there is (for a reason I never understood, there is another answer on site discussing this) a discontinuity in that latex, following plain tex sets \lineskiplimit at 0pt but \lineskip at 1pt, so if the text just fits in at 9pt spacing that will be allowed even if it is only adding .0001pt glue between the lines, but if you ask for 8pt then that will trigger \lineskip so even line spacing is abandoned, so you get the natural height lines (around 9pt) plus 1pt \lineskip padding so more like 10pt total. – David Carlisle Jun 14 '20 at 11:23
  • @TobiBS one of these probably says something relevant:-) tex.stackexchange.com/search?q=user%3A1090+%5Clineskiplimit – David Carlisle Jun 14 '20 at 11:25
  • Is it possible to set \lineskiplimit = -\maxdimen and then trigger a warning, everytime LaTeX detects a clash of glyphs? – TobiBS Jun 16 '20 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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