According to this answer of the question change space to only a part of the document (about 8 years ago), the effect of setspace' declaration commands (\singlespacing, \onehalfspacing, \doublespacing) should be limited by groups.
But the following MCE shows that:
- outside groups, these commands have the expected effect.
- inside groups, these commands have... no effect!
Do you know why?
\documentclass{article}
\usepackage{setspace,lipsum,xcolor}
% Paragraphs in red: in single spacing.
% Paragraphs in blue: (should be) in double spacing.
\begin{document}
\footnotesize % In order to get a single page.
% Single spacing is the default.
\color{red}
\lipsum[1]
% \doublespacing outside a group switches to double spacing.
\doublespacing
\color{blue}
\lipsum[1]
% Back to default: \singlespacing outside a group switches to single spacing.
\singlespacing
\color{red}
\lipsum[1]
% \doublespacing inside a group DOESN'T switch to double spacing.
{% %% <<<<<<< begin a group
\doublespacing
\color{blue}
\lipsum[1]
} %% <<<<<<< end a group
% \doublespacing inside a group DOESN'T switch to double spacing.
\bgroup %% <<<<<<< begin a group
\doublespacing
\color{blue}
\lipsum[1]
\egroup %% <<<<<<< end a group
\end{document}
