In a LaTeX beamer document, is there a way to change line spacing only for the main text body – i.e. for everything between \begin{frame}
and \end{frame}
? In particular if using \linespread
and its variants in the preamble the line spacing will also increase in multi-line titles or if the respective beamertheme uses newlines in its layout.
I also tried using \linespread
within a frame but to no avail.
[Tex/LaTex] Linespacing only for main text body
beamerline-spacing
Best Answer
If you have a title on each
frame
, your generic structure would probably resembleAs such, you have the
\frametitle
command as a hook that you can use to initiate a different line spacing for the remainder of theframe
. And, instead of using the traditional\linespread{<factor>}
to modify the spacing, use\setstretch{<factor>}
from thesetspace
package. To that end, include the following in your preamble:This will typeset the regular
\frametitle
and immediately after it call\setstretch{2}
which increases ("doubles") the line spacing for the remainder of the group. Since theframe
environment provides the necessary scope boundary,\setstretch
only has an effect until\end{frame}
. This allows for only theframe
content to be typeset under a different line spacing, leaving titles untouched in terms of this stretch factor. Additionally, a natural form of automation by redefinition of the existing commands allow for legible and transferable code.Here's a minimal example showing this:
Of course, this relies on the fact that your
frame
has the structure suggested at the start. So, aframe
without a title would be void of any line spacing alterations. Since you didn't mention this in your question, I assume this is not a problem. However, such modifications are always possible, given an alternative/suitable hook.The
lipsum
package was merely used to provide filler text on slide 4.To see the global effect of
\setspace{2}
on theframe
titles, uncomment\setspace{2}
in the preamble.