0

I have titles to chapters and sections that span two lines, and I want the interline spacing to be about a quarter of what it is now. As these titles are listed in the Table of Contents, the interline spacing is perfect. I know that this same question has been asked on stackexchange. Here is a link to one of them.

Double-spaced paragraphs, single-spaced headers

The code in the answers did not get me single spacing.

Here is the code for the main file. I use the "\include" command to include an introduction and two chapters.

\documentclass[10pt, oneside]{book}

% packages \usepackage{amssymb, amsmath, amsthm}

% these make top, right, bottom margins confirming to the requirements

\usepackage[a4paper,bindingoffset=0.0in,% left=1.5in,right=1in,top=1in,bottom=1in,% footskip=.25in]{geometry}

\usepackage{setspace} \usepackage{blindtext}

% small stuff \usepackage{amsfonts} \usepackage{amscd} \usepackage{mathbbol} \usepackage{hyperref} \urlstyle{same}

\usepackage{footnote}

\hypersetup{colorlinks,linkcolor={black},citecolor={black},urlcolor={black}}

\usepackage{microtype} % \usepackage{showkeys} % uncomment this when editing cross-references \numberwithin{equation}{section}

%This makes the chapters start with a 2" margin \makeatletter \renewcommand@makechapterhead[1]{% \vspace{0.75in}% {\parindent \z@ \raggedright \normalfont \ifnum \c@secnumdepth >\m@ne \huge\bfseries @chapapp\space \thechapter \par\nobreak \vskip 20\p@ \fi \interlinepenalty@M \Huge \bfseries #1\par\nobreak \vskip 40\p@ }} \renewcommand@makeschapterhead[1]{% \vspace{0.75in}% {\parindent \z@ \raggedright \normalfont \interlinepenalty@M \Huge \bfseries #1\par\nobreak \vskip 40\p@ }} \makeatother

%------------------------------------------------

% doesn't count introduction when numbering theorems, etc. \setcounter{chapter}{0}

% makes page numbers appear \pagestyle{plain}

\begin{document}

% makes the page numbers roman numerals, doesn't count % these pages in the table of contents \frontmatter

\thispagestyle{empty}

\vbox to 1truein{}

\centerline{Fairy Tales throughout History}

\vskip 200pt

\centerline{BY} \vskip 10pt

\centerline{A Storyteller} \vskip 10pt

\centerline{BA, Bard College} \centerline{MA, Columbia University}

\vskip 215pt

\centerline{DISSERTATION} \vskip 10pt

\centerline{Submitted in partial fulfillment of the requirements for} \centerline{the degree of Doctor of Philosophy in English} \centerline{in the Graduate School of} \centerline{Columbia University}

\newpage

\thispagestyle{empty}

\vbox to 8.5truein{}

\centerline{\copyright\ Copyright by A Storyteller 2023}

\

\centerline{All Rights Reserved}

\newpage

\chapter*{Abstract} \begin{doublespace} Fairy tales' rich, imaginative stories for children~---~involving fantastical creatures and exotic places~---~offer far more than entertainment and happily-ever-after endings. They furnish children with a landscape for critical thinking skills and a context in which children can evaluate their own emotions and decision making. \end{doublespace}

\newpage

\chapter*{Dedication} \bigskip

\centerline{Dedicated to the Grimm Brothers and Hans Christian Anderson}

\newpage

\chapter*{Acknowledgements} I wish to thank Walt Disney for animating various fairy tales in full color.

\newpage

\tableofcontents

% Changes page numbers to regular numbers, resets the counter \mainmatter

%This gives 10pt font with 20pt spacing, text from here should be double spaced \fontsize{10}{20pt} \selectfont

% \include puts in the .tex file with the given name % make sure that these files don't have any preamble material

\begin{doublespacing}

\include{Introduction_February_18}

\include{Chapter_1_February_18}

\include{Chapter_2_February_18}

\end{doublespacing}

% add a new chapter without a chapter # for the references \addcontentsline{toc}{chapter}{Bibliography}

\begin{thebibliography}{9}

\bibitem[Southey 1837]{Southey}Robert Southey, \emph{The Doctor}, Longman, Rees, Orme, Brown, Green and Longman, London, England, 1837, pages 318-326

\end{thebibliography}

\end{document}

Here is the code for "Introduction_February_18".

%
%
%
% Introduction
%
%

% make introduction a chapter without a # \chapter*{Introduction (In case I decide to have a more descriptive name for the introduction, I want it to be single spaced or maybe half-line spaced)}

% and include it on the table of contents \addcontentsline{toc}{chapter}{Introduction}

We will look at various fairy tales and myths in civilizations throughout history!

Here is the code for "Chapter_1_February_18".

%
%  Chapter 1
%
%
%
%
%
\chapter{Fairy Tales from Ancient Greece (I want the title of this chapter to be single spaced or maybe half-line spaced)}
\label{ch1}
%The label lets you refer to the chapter by number later.

\section{Theogony: Clash of the Titans (Ya know - I also want the title of this section to be single spaced or maybe half-line spaced)} \label{s1.1}

Talk some more.

\subsection{A Subsection Title} \label{ss1.1.1}

Be specific.

\subsection{Another Subsection Title} \label{ss1.1.2}

\section{Prometheus and the Theft of Fire (Single spaced or maybe half-line spaced)} \label{s1.2}

Talk it up.

% you can do the same with sections, just * them and add them to the contents if you want.

\section{Pandora’s Box (Same here - single spaced or maybe half-line spaced)}

Keep going

\section{The Abduction of Persephone by Hades (Same here - single spaced or maybe half-line spaced)}

Way to go!

Here is the code for "Chapter_2_February_18".

%
%  Chapter 2
%
%
%
%
%
\chapter{Fairy Tales from Ancient Rome (I want the title of this chapter to be single spaced or maybe half-line spaced)}
\label{ch2}
% the label lets you refer to the chapter by number later.

Talk a little. \cite{keyword1}

\section{Romulus and Remus}

{\em Pages of exposition.}

\section{Aeneas (by the poet Virgil)}

{\em Pages of exposition.} \label{s2.1}

Talk a lot.

\section{Scaevola}

{\em Pages of exposition.} \label{s2.2}

Do it again.

\section{The Legend of Lucretia}

{\em Pages of exposition.}

user143462
  • 1,039

2 Answers2

1

It seems you need to load titlesec package and append following lines in your preamble.

\titleformat{\chapter}[display]
    {\singlespacing\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
    {\singlespacing\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
    {\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
    {\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}

These macros insert `singlespacing` to the format field of each of the corresponding section. The documentqation provides detailed info about the macro itself on page 3 and 4, as well as examples of standard formatting on page 24.

EDIT. As a side note, for a custom line spread, change \singlespacing to \setstretch{<factor>}; <factor> equal to 1.0 corresponds to a single spacing. Anything larger than 1.0 increases the line spread.

Celdor
  • 9,058
  • I replaced \singlespacing with \setstretch{0.25} ... but I had to delete the commands in the preamble in the code in my original post between \makeatletter and \makeatother to get the spacing that I wanted. – user143462 Feb 19 '23 at 19:17
  • This almost gives me what I want. – user143462 Feb 19 '23 at 19:18
  • In my ridiculously long name for my "Introduction," the word "spaced" ignores the right margin and is typeset almost at the right edge of the page. – user143462 Feb 19 '23 at 19:20
  • How do I correct this? For your convenience, I will post the new preamble as an answer. – user143462 Feb 19 '23 at 19:23
  • @user143462 I'd stick to titlesec and would not mix it up with other solutions as I find it more convenient. I run your new code and don't see problems with words exceeding the right margin. Are you using different fonts or load different language? BTW, you need to add \phantomsection before \addcontentsline. Otherwise, the link in ToC will lead to 2.4 The Legend of Lucretia, not to the Bibliography! – Celdor Feb 19 '23 at 21:34
  • Somehow, we are getting different pdf files. I compiled it - the same code as I posted as an answer - and the word "spaced" in Introduction is still typeset beyond the right margin ... but "spaced" is typeset on separate lines in the titles of the two chapters! Also, when I click on "2.4 The Legend of Lucretia" in the Table of Contents, I am led to that section. – user143462 Feb 19 '23 at 23:36
  • 1
    and you haven't changed included files? I can share a project with your files and PDF I get is the same as I would compile all files locally--everything seems to be within margins. – Celdor Feb 20 '23 at 08:23
  • The included files on my LaTeX editor are what I had posted. I see that in your pdf, the "spaced" in the title of the Introduction is typeset on the following line. That is not happening in my pdf. Notice that "spaced" gets typeset on its own lines in the titles of the following two chapters - just like in my pdf. It is odd. (Thanks for sharing the pdf that you got and drawing the margins on each page!) – user143462 Feb 20 '23 at 15:48
  • I want to typeset an expression in math mode in the title of a third chapter - such as $a_{n} = a_{n-1} + a_{n-2}$. How can I do this? I get an error message. – user143462 Feb 20 '23 at 15:49
  • Make sure your TeX distribution is up-to-date. In section titles bookmarks are causing the issue with math expressions! Have a look at this answer as well as the section 6.1.2 on page 27 of the hyperref. The macro is called \texorpdfstring{TEXstring}{PDFstring}. I also updated your project file on Overleaf (the same link). The chapter right after Introduction have the math. Also, look at bookmark in the PDF Overleaf generates. – Celdor Feb 20 '23 at 16:13
  • Thanks for your response. I am looked at the link you provided and will try to implement it today. – user143462 Feb 24 '23 at 17:06
  • Sorry for the delay; it took me a month to get around to compiling the code that you provided in the link. I am getting the following error message: !Font U/bbold/m/n24.88=bbold25 at 24.88pt not loadable: Metric (TFM) file not found. I have no clue what this error message means, but I know it is not compiling due to the expression for the Fibonacci sequence typeset in math mode in the title in Chapter 1. It does compile in Overleaf, though. – user143462 Mar 29 '23 at 22:28
  • Hi, I wasn't waiting, so no need to be sorry. The error suggest a missing font file. If you've moved a project to a new location/machine etc. and your document loads custom fonts, you also have to make sure those files are available in new location. This is as far as I can go. It's best will be if you ask a new question. – Celdor Mar 29 '23 at 23:43
  • I just posted a shortened version of the code at https://tex.stackexchange.com/questions/681312/error-compiling-code-due-to-text-in-the-title-of-a-chapter-that-is-encoded-in-ma. – user143462 Mar 30 '23 at 15:57
0

This is the main file, as suggested by Celdor. This does give me the interline spacing that I want in the titles of chapters ... but title of one word in the "Introduction" goes past the right margin and almost gets to the right edge of the page.

\documentclass[10pt, oneside]{book}

% packages \usepackage{amssymb, amsmath, amsthm} %This package allows Chapter titles to be single spaced. \usepackage{titlesec} \titleformat{\chapter}[display] {\setstretch{0.25}\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge} \titleformat{\section} {\setstretch{0.25}\normalfont\Large\bfseries}{\thesection}{1em}{} \titleformat{\subsection} {\singlespacing\normalfont\large\bfseries}{\thesubsection}{1em}{} \titleformat{\subsubsection} {\singlespacing\normalfont\normalsize\bfseries}{\thesubsubsection}{1em}{}

% these make top, right, bottom margins confirming to the requirements

\usepackage[a4paper,bindingoffset=0.0in,% left=1.5in,right=1in,top=1in,bottom=1in,% footskip=.25in]{geometry}

\usepackage{setspace} \usepackage{blindtext}

% small stuff \usepackage{amsfonts} \usepackage{amscd} \usepackage{mathbbol} \usepackage{hyperref} \urlstyle{same}

\usepackage{footnote}

\hypersetup{colorlinks,linkcolor={black},citecolor={black},urlcolor={black}}

\usepackage{microtype} % \usepackage{showkeys} % uncomment this when editing cross-references \numberwithin{equation}{section}

%------------------------------------------------

% doesn't count introduction when numbering theorems, etc. \setcounter{chapter}{0}

% makes page numbers appear \pagestyle{plain}

\begin{document}

% makes the page numbers roman numerals, doesn't count % these pages in the table of contents \frontmatter

\thispagestyle{empty}

\vbox to 1truein{}

\centerline{Fairy Tales throughout History}

\vskip 200pt

\centerline{BY} \vskip 10pt

\centerline{A Storyteller} \vskip 10pt

\centerline{BA, Bard College} \centerline{MA, Columbia University}

\vskip 215pt

\centerline{DISSERTATION} \vskip 10pt

\centerline{Submitted in partial fulfillment of the requirements for} \centerline{the degree of Doctor of Philosophy in English} \centerline{in the Graduate School of} \centerline{Columbia University}

\newpage

\thispagestyle{empty}

\vbox to 8.5truein{}

\centerline{\copyright\ Copyright by A Storyteller 2023}

\

\centerline{All Rights Reserved}

\newpage

\chapter*{Abstract} \begin{doublespace} Fairy tales' rich, imaginative stories for children~---~involving fantastical creatures and exotic places~---~offer far more than entertainment and happily-ever-after endings. They furnish children with a landscape for critical thinking skills and a context in which children can evaluate their own emotions and decision making. \end{doublespace}

\newpage

\chapter*{Dedication} \bigskip

\centerline{Dedicated to the Grimm Brothers and Hans Christian Anderson}

\newpage

\chapter*{Acknowledgements} I wish to thank Walt Disney for animating various fairy tales in full color.

\newpage

\tableofcontents

% Changes page numbers to regular numbers, resets the counter \mainmatter

%This gives 10pt font with 20pt spacing, text from here should be double spaced \fontsize{10}{20pt} \selectfont

% \include puts in the .tex file with the given name % make sure that these files don't have any preamble material

\begin{doublespacing}

\include{Introduction_February_18}

\include{Chapter_1_February_18}

\include{Chapter_2_February_18}

\end{doublespacing}

% add a new chapter without a chapter # for the references \addcontentsline{toc}{chapter}{Bibliography}

\begin{thebibliography}{9}

\bibitem[Southey 1837]{Southey}Robert Southey, \emph{The Doctor}, Longman, Rees, Orme, Brown, Green and Longman, London, England, 1837, pages 318-326

\end{thebibliography}

\end{document}

user143462
  • 1,039