1

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.

  • 2
    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
1

igChapterSpacing

\documentclass[12pt,twoside]{book}

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

\makeatletter
\patchcmd{\@makechapterhead}{\raggedright}{\raggedright\setstretch{1}}{}{}
\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}
1

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):

enter image description here

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.