# Linespacing changes randomly

In my latex document I'm using a linespacing of 1.5. For the appendix I set it to 1.1 with the linespread command:

\begin{appendix}
\clearpage
\pagenumbering{roman}

\setdefaultleftmargin{1em}{}{}{}{}{}
\linespread{1.1}\selectfont
\section{Appendix}
\subsection{Test 1}
Lorem ipsum ...
\subsection{Test 2}
Lorem ipsum ...
\end{appendix}


This works for the whole appendix, except for the last subsection, no matter how many subsections there are. There it just randomly switches back to a linespacing of 1.5 again. Even if I put the linespread command in this last subsection it wont have the linespacing. Any clues how I could apply the linespacing to the whole appendix?

• it's not random, it just follows your instructions, leave a blank line before \end{appendix} (\appendix is not really designed to be used as an environment) – David Carlisle Dec 10 '16 at 17:17
• Welcome to TeX.SE. It's not a good idea to manipulate the lowel-level parameter \linespread directly. Instead, load the setspace package and issue instructions such as \setstretch{1.5} and \setstretch{1.1}. – Mico Dec 10 '16 at 17:18
• Thank you both very much. The first suggestion works fine. What a tiny change to make! But given the problems I decided to follow the second suggestion to use \setstretch{1.1} – Martin Cup Dec 10 '16 at 17:26
• you need the blank line anyway. – David Carlisle Dec 10 '16 at 19:26

## 1 Answer

If \appendix had been designed as an environment, then \endappendix would have been defined to add \par which is equivalent to a blank line and avoided the problem. As it is \end{appendix} is just \endgroup as such you have something equivalent to

\begingroup
\linespread{1.1}\selectfont
a paragraph of text
\endgroup

..


The linespacing is a paragraph parameter and the value used is the value at the end of the paragraph. The paragraph ends at the blank line after the group ends, at which point the values have reset to the values they had before the group. If instead you have

\begingroup
\linespread{1.1}\selectfont
a paragraph of text

\endgroup

..


Then the paragraph ends at the blank line before the group ends and so is set with the local paragraph settings.