I want to locally apply double spacing in a certain paragraph of the document by using \begin{doublespacing}
and \end{doublespacing}
from the setspace
package. However, I found it only takes effects if an extra blank line is added to the code, which is redundant for the code readability… Is there a better way/workaround to have double-spacing without the additional blank line?
MWE:
\documentclass[headsepline,footsepline,footinclude=false,twoside,fontsize=12pt,paper=a4,listof=totoc,bibliography=totoc,BCOR=12mm,DIV=12,chapterprefix=on,numbers=noenddot]{scrbook} % two-sided
\usepackage{setspace}
\usepackage{lipsum}
\begin{document}
\begin{doublespacing}
\lipsum[1]
\end{doublespacing}
\begin{doublespacing}
\lipsum[1]
% ---> Extra blank line necessary for the double-spacing
\end{doublespacing}
\end{document}
Best Answer
What you've discovered is not a bug but a core feature of the entire TeX paragraph builder system: The line-spacing within a paragraph depends on where the paragraph's end actually occurs. In the case of
the end of the paragraph -- as far as TeX is concerned -- occurs not at the final period (aka full stop) of the lipsum filler text but after
\end{doublespacing}
. But by then the scope of thedoublespacing
environment has ended; hence, the text beloniging to lipsum[1] is (correctly, in my view) typeset single-spaced.There are several ways to trigger the end of a paragraph:
One or more all-blank lines in the input. Incidentally, the line you present in the second code snippet of your posting is not all-blank (since it contains a comment) and therefore, contrary to your claim, does not suffice to make the paragraph double-spaced.
An explicit
\par
directive.Implicit paragraph break instructions, issued by commands such as
\chapter
,\section
,\begin{theorem}
, and many more. Aside: the\\
("double backslash") instruction induces a line break but not a paragraph break according to TeX's lexical rules.Your main question was,
I'd say that issuing an explicit
\par
directive is your main alternative to leaving an all-blank line.