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}

1 Answer 1

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}
3
  • 1
    And it's better to use \linespread{1.5}\selectfont
    – egreg
    Commented Apr 28, 2015 at 22:45
  • What does \linespread do which makes it better to use?
    – Brian
    Commented Apr 28, 2015 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:-) Commented Apr 28, 2015 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .