If I understand you right (I've also read this thread on www.mrunix.de) you want your document to be typeset with \onehalfspacing
with the exception of some lists, the glossary and the bibliography which should each be typeset with \singlespacing.
To achieve this you have to keep the following in mind: The setspace
package provides commands \singlespacing,
\onehalfspacing
and \doublespacing
as well as environments singlespace,
onehalfspace
and doublespace.
The former are used in the preamble to set up the overall spacing whereas the latter are used within the document to change the spacing locally. Hence, the structure of your input file should be as follows:
\documentclass{article}
\usepackage{setspace}
\onehalfspacing
....
\begin{document}
...
\begin{singlespace}
\printglossary
\end{singlespace}
...
\end{document}
You can use the etoolbox
package to insert \singlespacing
just before the sectional units, and then to append \doublespacing
:
\documentclass{article}
\usepackage{setspace}
\usepackage{etoolbox}
\makeatletter
\pretocmd{\@sect}{\singlespacing}{}{}
\pretocmd{\@ssect}{\singlespacing}{}{}
\apptocmd{\@sect}{\doublespacing}{}{}
\apptocmd{\@ssect}{\doublespacing}{}{}
\makeatother
\doublespacing
\begin{document}
Nunc venenatis nulla eu arcu pellentesque eu molestie nunc condimentum.
Donec sodales lacinia dictum.
Sed aliquam turpis quis enim bibendum pharetra.
This is the last paragraph in section i.
\section{The Next Section Which Has a Fairly Long Name that Stretches Over Two Lines}
This is the first paragraph in section i+1.
Cras ut tortor vel dui ultricies dapibus vitae sit amet nisi.
Aliquam rhoncus leo id eros volutpat faucibus.
Integer lectus elit, varius et semper eget, tristique vel odio.
\end{document}
This will apply to \section
, \subsection
, \subsubsection
.
Another option is to use the titlesec
package:
\documentclass{article}
\usepackage{setspace}
\usepackage{titlesec}
\titleformat{\section}
{\singlespacing\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}
\doublespacing
\begin{document}
Nunc venenatis nulla eu arcu pellentesque eu molestie nunc condimentum.
Donec sodales lacinia dictum.
Sed aliquam turpis quis enim bibendum pharetra.
This is the last paragraph in section i.
\section{The Next Section Which Has a Fairly Long Name that Stretches Over Two Lines}
This is the first paragraph in section i+1.
Cras ut tortor vel dui ultricies dapibus vitae sit amet nisi.
Aliquam rhoncus leo id eros volutpat faucibus.
Integer lectus elit, varius et semper eget, tristique vel odio.
\end{document}
Or, using the reduced syntax:
\usepackage{titlesec}
\titleformat*{\section}{\normalfont\Large\bfseries\singlespacing}
\titleformat*{\subsection}{\normalfont\large\bfseries\singlespacing}
\titleformat*{\subsubsection}{\normalfont\normalsize\bfseries\singlespacing}
By the way, the setspace
package provides several commands and environments; the commands (switches) end in "ing": \singlespacing
, \onehalfspacing
, \doublespacing
, whereas the environments are singlespace
, onehalfspace
, doublespace
.
Using \doublespace
are you are doing (as a switch) is not entirely correct; the following simple document:
\documentclass{article}
\usepackage{setspace}
\doublespace
\begin{document}
test
\end{document}
when processed will show in the output console a message
(\end occurred inside a group at level 1)
### semi simple group (level 1) entered at line 4 (\begingroup)
which indicates that a group started but was never ended (in this case, the group created by the \doublespace
command associated to the environment doublespace
). The correct form of using the switch is
\documentclass{article}
\usepackage{setspace}
\doublespacing
\begin{document}
test
\end{document}
and, for the corresponding environment:
\documentclass{article}
\usepackage{setspace}
\begin{document}
\begin{doublespace}
test...
\end{doublespace}
\end{document}
Best Answer
To not use double-spacing for the headings you could add
\setstretch{1}
to the setting of font elementdisposition
:As alternative you also could use
\linespread{1}
, but in this case you should additionally append\selectfont
to the font element somewhere after the\linespead
command. Otherwise, if a sectioning level would not have a font setting the activation of the new line-spread would be missing.If you want a sequence of you document without double-spacing use either environment
singlespace
or command\singlespacing
. But if you would use this before a chapter heading, the vertical space above the chapter head would change. So for the bibliography better use it after the heading, e.g., using\AfterBibliographyPreamble
.results in:
You could also use the opposite: Use
doublespacing
environment only for those sequences of your document that should be double-spaced:Here the space about chapter heading would be different from the example above: