15

I have read that line spacing in a LaTeX document is controlled by the \baselinestretch macro, for example here. Setting \baselinestretch in the preamble does in fact change line spacing. When I redefine \baselinestretch inside the document however, the line spacing is unaffected.

It is clearly possible to change the line spacing mid-document, as demonstrated by the setspace package, but why does simply redefining \baselinestretch not do this?


As an example, I would expect the following code to have one paragraph of lorem ipsum at 1.5 spacing, followed by the same paragraph at 1.0 spacing, but both come out as 1.5 spaced.

\documentclass{article}
\usepackage{lipsum}
\def\baselinestretch{1.5}

\begin{document}
\lipsum[1]
\hrule
\def\baselinestretch{1}
\lipsum[1]
\end{document}
Brian
  • 619

1 Answers1

15

\baselinestretch just sets the multiplier used at the next font selection, so you need \selectfont.

\documentclass{article}
\usepackage{lipsum}
\def\baselinestretch{1.5}

\begin{document}
\lipsum[1]
\hrule
\def\baselinestretch{1}\selectfont
\lipsum[1]
\end{document}
David Carlisle
  • 757,742
  • 1
    And it's better to use \linespread{1.5}\selectfont – egreg Apr 28 '15 at 22:45
  • What does \linespread do which makes it better to use? – Brian Apr 28 '15 at 22:46
  • 3
    @Brian not a lot, it leaves latex in a bit better state if you don't use \selectfont straight away but if you do it comes to the same thing, but perhaps looks more declarative rather than using the general \renewcommand (or especially looks better than dropping down to the primitive \def:-) – David Carlisle Apr 28 '15 at 23:03