Change line spacing inside the document
You can use \setstretch{}
. If you want to only affect a certain content you can use it with a group.
You can also apply any size changing switches such as \small
or \tiny
inside the {}
group as well.
Code
\documentclass[12pt,a4paper]{book}
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\lipsum[1]
{\setstretch{1.0}\color{blue}
\lipsum[2]
}
\lipsum[3]
\end{document}
Alternatively, the following solution is a bit cleaner:
\documentclass[12pt,a4paper]{book}
\usepackage{lipsum}
\usepackage{setspace}
\begin{document}
\onehalfspacing % Set line spacing to 1.5
\lipsum[1]
\singlespacing % Reset line spacing to 1 from here on
\lipsum[2]
\onehalfspacing % Reset line spacing to 1.5 from here on
\lipsum[3]
\end{document}
Also, instead of \singlespacing
and \onehalfspacing
you can use \setstretch{1}
and \setstretch{1.5}
for greater flexibility.
Other values
Other line spacing values that lie in between onehalf
, single
and double
can also be achieved with:
\usepackage{setspace}
\begin{spacing}{1.125}
…
\end{spacing}