# Single-space chapter and section titles with double-spaced document

I have a problem trying to get my chapter and section titles singlespaced (when they run over more than one line). I found two solutions in Stack Exchage. One advices to use the etoolbox. The other recommends using the titlesec pagackage. The first solution poses problems with chapter titles, whereas the second one with section titles. I cannot find any other option that works for both and that is simple and easy to implement.

• please post an MWE so that we have something to start with. – Runar Sep 9 '16 at 8:48
• Links to the two mentioned solutions would help. By double spacing do you mean \baselineskip=2\normalbaselineskip ? – John Kormylo Sep 10 '16 at 12:40

\documentclass[12pt,twoside]{book}

\usepackage{geometry}
\geometry{a5paper}
\usepackage{etoolbox}
\usepackage{blindtext}
\usepackage[doublespacing]{setspace}

\makeatletter
\pretocmd{\@sect}{\singlespacing}{}{}
\pretocmd{\@ssect}{\singlespacing}{}{}
\apptocmd{\@sect}{\doublespacing}{}{}
\apptocmd{\@ssect}{\doublespacing}{}{}
\makeatother

\begin{document}

\chapter{This is a long chapter title, ant, bee, chameleon}
\blindtext

\section{This is a long section title, anne, betty, cathy}
\blindtext

\subsection{This is a long subsection title, abe, bill, carl}
\blindtext

\end{document}


Assuming you're using one of the "standard" LaTeX document classes -- article, report, and book -- or a document class that's based on one of the standard classes, you could achieve your objective simply by adding the following two directives in the preamble:

\usepackage{sectsty}
\allsectionsfont{\singlespacing\raggedright}


An MWE (with much of the code borrowed from the answer the OP posted):

\documentclass[12pt,twoside]{book}
\usepackage[a5paper]{geometry}
\usepackage{lipsum}
\usepackage[doublespacing]{setspace}

\usepackage{sectsty}
\allsectionsfont{\singlespacing\raggedright}
% "\raggedright" is optional - but a good idea!

\begin{document}
\chapter[Shortened chapter title]{This is a long chapter title, ant, bee, chameleon}
\lipsum[2]

\section[Shortened section title]{This is a long section title, anne, betty, cathy}
\lipsum[2]

\subsection{This is a long subsection title, abe, bill, carl}
\lipsum[2]
\end{document}