Why do I have to use \par if I change font size withing a group scope?

I was working on a Beamer presentation, and noticed that, if I open a group scope and use a \tiny, the font size will bet set, but there will be a large space between lines. However, if I issue a \par at the end of the paragraph, it works as intended:

\documentclass[t]{beamer}
\newcommand{\shortlipsum} {Lorem ipsum dolor sit amet, consectetuer
vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy
eget, consectetuer id, vulputate a, magna. Donec vehicula augue euneque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames
ac turpis egestas. Mauris ut leo. Cras viverra}

\begin{document}
\begin{frame}
\shortlipsum

{\tiny
\shortlipsum\par   % <--- removing this \par will break line spacing
}
\end{frame}
\end{document}


Here's a comparison between not using and using \par:

Am I doing it the right way? Why is \par the right way?

• \par fixes the line spacing. – Johannes_B Jul 31 '18 at 16:50
• You can also use \vbox{\tiny\shortlipsum}. – John Kormylo Jul 31 '18 at 17:04
• Paragraphs are the fundamental building block for TeX and LaTeX. To avoid creating the oh-so dreaded ransom note look, line spacing within a paragraph is kept consistent, even if there are font size changes. Thus, if you want to change line spacing, you have to create a new paragraph. One way to create a new paragraph, naturally, is \par. I'd say that unless you have an extremely unusual use case (I can only assume it's not related to typesetting various lipsum strings...), the right way to go about things is to create paragraph breaks when whenever there's a sustained change in font size. – Mico Jul 31 '18 at 19:24
• in a document it is more common to use a blank line rather than \par (although they are the same thing) – David Carlisle Jul 31 '18 at 21:14

Johannes_B has (very concisely) given the answer -- "\par fixes the line spacing." however, maybe a bit of explanation would be useful.

since tex breaks lines by paragraph, there's a lot that isn't known until the paragraph is ended, at which time line breaks and other font-dependent attributes (like \baselineskip) are "frozen". so whatever is in effect when \par is encountered is what is used for the whole paragraph.

if you follow multiple lines in a paragraph in "huge" type by a segment in \tiny, it may look like the line spacing of the huge part isn't affected, but it is -- the usual extra "leading" between lines won't be there. this will be abundantly obvious if you use lowercase type and one line doesn't have any descenders.

in your example, you have isolated the \tiny component in a closed group, so after the lines are broken, the line spacing of the larger font is used. if you had not so isolated it, you would have seen that the lines of larger type were much closer together, using the \baselineskip of tiny in force at the end of the paragraph.

latex "protects" many environments from potential problems when type size is changed by including \par before the end of the environment, so a user is probably not aware of this nicety.

in math documents, it's sometimes necessary to decrease the type size of a displayed equation. in such a situation, it's always necessary to check that the baseline spacing of the preceding paragraph hasn't been affected, and if it has, extra manual adjustments must be applied.

here is an example using the scenario described for a math document. this is much more insidious than the pure text situation described in the question, but the principle is exactly the same -- \par is needed to prevent an unwanted result at a size transition.

here is the input, which uses no packages, only a "basic" document class.

\documentclass{article}

\begin{document}
The purpose of this example is to show the effect of changing
the font size without issuing a paragraph break in appropriate
places.  First, a normal size display.
$a + b + c = d + e + f$
Follow this by a couple of lines of text.  Note that there is
an implicit paragraph break at the end of the display, even
though the text following the display isn't indented.  Now
change the font size in the display; best to do it in a group.
\begingroup \footnotesize
$a + b + c = d + e + f$
\endgroup
Follow this by more text and examine the baselines of the
two preceding blocks of text.  Now, try this again, but this
time include an explicit \verb+\par+ before the display.  This
can mess up the vertical space before the display, and will
allow the page to break at that point, but the
baselines of this text block remain intact.\par
\begingroup \footnotesize
$a + b + c = d + e + f$
\endgroup
End with some more text just to make sure that the treatment
of the transition is equivalent.
\end{document}

• May I ask you to include an example? I don't understand the second part of your comment, with the remark of not isolating \tiny. Do you mean if I had not isolated in a separate paragraph or in the previous paragraph? In other words, do you mean \shortlipsum\par\tiny\shortlipsum or \shortlipsum\tiny\shortlipsum\par? – giusti Aug 4 '18 at 14:13
• i hope the added example is clear. regarding your example, the appropriate code would be \shortlipsum\par \tiny\shortlipsum. and if anything will follow this, a \par (or a blank line) following the \tiny block would be needed as well. – barbara beeton Aug 4 '18 at 16:46