1

I've noticed that the second argument of \fontsize appears to get ignored sometimes when wrapped in curly braces. Instead, the text appears to be set with minimal leading.

Example 1:

\fontsize{18}{100}
\selectfont
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah

Output with ridiculously large space between lines, as specified:

Output from example 1

Example 2:

{\fontsize{18}{100}
\selectfont
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah}

Output with no space between lines, despite request for outrageous space between lines:Output from example 2

I've tried this in several setups: on my own machine, and in two online compilers, in PDFLaTeX right out of the box, with no packages loaded. I noticed it for the first time while using XeLaTeX, though.

Is this a bug in \fontsize? Is it somehow supposed to work like this—is there some rational reason for the leading to break when the thing is placed in curly braces?

To add to the weirdness, the strange behavior appears to go away if an empty line is added before the closing curly brace. So the following example gives output apparently identical to that of Example 1.

Example 3:

{\fontsize{18}{100}
\selectfont
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah

}
  • 4
    This is not strange at all. The inter line spacing only has effect when the paragraph is built, that is, when you use \par or leave an empty line. In your example 2, the font size is changed within the group, then when the group is closed (}), the font size (and line spacing) are restored, so the line spacing is taken from outside the group. There are other answers in this site that explain this better than I did... I'll find them. – Phelype Oleinik Aug 20 '18 at 21:32
5

No bug at all, but well documented behavior.

A paragraph is typeset with the baseline skip active when the \par command is encountered and executed. Note that a blank line is the same as \par.

When you do

{\baselineskip=100pt abc}\par

the } ends the effect of \baselineskip=100pt, which is set back to the previous value it had when { had been scanned. The paragraph will be set with the value of \baselineskip holding outside the group.

Conversely,

{\baselineskip=100pt abc\par}

will typeset the paragraph (represented by abc) with a 100pt baseline skip.

Adding a blank line before } is the same as explicitly typing \par.

For completeness, \fontsize{18}{100}\selectfont sets the font size to 18pt and the baseline skip to 100pt. In your case, 18pt is substituted with 17.24pt, and the paragraph is set with a standard baselineskip; the huge font size makes \lineskiplimit and \lineskip entering the scene, so the lines are separated by \lineskip vertical space.

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