5

I have document which require me that chapter headings consist of two parts: (1) Chapter number (Chapter 1, Chapter One etc.) or any other text with similar function and (2) descriptive title below number that can be long. I was able to push descriptive title below chapter number and style it according to my needs with following macro:

\documentclass[final]{book}
\usepackage{lipsum}

\def \mylongchapter#1#2{
\chapter*{\centering{\LARGE #1} \\* \textnormal{\Large #2}}
\addcontentsline{toc}{chapter}{#1: #2}
}

\begin{document}

\mylongchapter{Chapter 1}{This Chapter Have Very Interesting and Long Title Below Chapter Number}

\lipsum[11-30]

\end{document} 

Which produces this:

long chapter title

Questions:

  1. Is there any better way to typeset chapters with such descriptive title than what I did?
  2. How to control (or remove) spacing/gap between two or more lines of descriptive title (see picture below)?
  3. How to control spacing between Chapter 1 and descriptive title?

gap between two lines of chapter title

  • 2
    I would rather use the \chapter[shorttitle]{longtitle} instead of switching to \chapter*. For the chapter head format: Perhaps titlesec, or the KOMA classes are appropiate. – user31729 May 29 '14 at 10:26
  • @ChristianHupfer Good to know that I can use \chapter[shorttitle]{longtitle}, but unfortunately it (1) does not allow for formatting manipulation of shorttitle as it is option to command and I can't use, for example, \chapter[\textnormal{shorttitle}]{longtitle} and (2) I need to use \chapter* because often I have chapters that can not be numbered automatically. – Rafal May 29 '14 at 10:35
  • The shorttitle is meant for the table of contents (TOC) and not for the display on the chapter starting page, I doubt that you want to make a very sophisticated formatting for the TOC and your example chapter is numbered – user31729 May 29 '14 at 10:38
  • @ChristianHupfer "The shorttitle is meant for the table of contents (TOC) and not for the display on the chapter starting page" - right, my mistake. "I doubt that you want to make a very sophisticated formatting for the TOC" - actually, I do have complex formatting for TOC and I need to put all text that is printed on page to TOC as well, but it wasn't relevant for that quesiton. – Rafal May 29 '14 at 10:42
6

enter image description here

You could try redefining @makechapterhead in the book class:

\documentclass[final]{book}
\usepackage{lipsum}

%\def \mylongchapter#1#2{
%\chapter*{\centering{\LARGE #1} \\* \textnormal{\Large #2}}
%\addcontentsline{toc}{chapter}{#1: #2}
%}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}% margin above chapter number
  {\parindent \z@ \centering \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \LARGE\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@% space between chapter number and chapter title
      \fi
    \fi
    \interlinepenalty\@M
    \Large \mdseries \centering #1 \par\nobreak
    \vskip 40 \p@% space below chapter title
  }}
\makeatother
\begin{document}

%\mylongchapter{Chapter 1}{This Chapter Have Very Interesting and Long Title Below Chapter Number}
\chapter{This Chapter Have Very Interesting and Long Title Below Chapter Number}
\lipsum[11-30]

\end{document}

You can change three numeric values (50\p@, 20\p@ and 40 \p@) to adjust margin above chapter number, space between chapter number and chapter title and space below chapter title respectively. See commens in the code for proper places to change those values.

EDIT: You can use setspace package to alter spacing like so:

\documentclass[final]{book}
\usepackage{lipsum}
\usepackage{setspace} %<========== package to adjust spacing
%\def \mylongchapter#1#2{
%\chapter*{\centering{\LARGE #1} \\* \textnormal{\Large #2}}
%\addcontentsline{toc}{chapter}{#1: #2}
%}

\makeatletter
\def\@makechapterhead#1{%
  \vspace*{50\p@}% margin above chapter number
  {\parindent \z@ \centering \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \LARGE\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@% space between chapter number and chapter title
      \fi
    \fi
    \interlinepenalty\@M
    \Large \mdseries \centering \onehalfspacing #1 \par\nobreak %<========== Add \doublespacing or \onehalfspacing or \singlespacing here
    \vskip 40 \p@% space below chapter title
  }}
\makeatother
\begin{document}

%\mylongchapter{Chapter 1}{This Chapter Have Very Interesting and Long Title Below Chapter Number}
\chapter{This Chapter Have Very Interesting and Long Title Below Chapter Number}
\lipsum[11-30]

\end{document}

And for \chapter*, I think redefining @makeschapterhead (note the 's' for starred) would do the same thing. But I suspect that you would be able to make all these changes with one of the packages mentioned in the other answers, maybe even more easily!

|improve this answer|||||
  • 1
    Thanks for answer. I have made few changes to your answer to make it clear for others that all three values can be adjusted. Do you know of any way to adjust spacing between lines of chapter title? Also, is there any more generic way to do what you did, to allow usage of \chapter* command - that is to use your solution without automatic chapter numbering? – Rafal Jun 2 '14 at 10:08
  • 1
    Answer updated. This might be of help to redefine @makeschapterhead: tug.ctan.org/macros/latex/unpacked/book.cls – srao Jun 2 '14 at 11:00
  • The link is broken. Can you please fix that. – urwaCFC Oct 19 '18 at 19:30
  • 1
    @urwaCFC here's the new link to the book class: tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/base/… – srao Oct 20 '18 at 21:17
4

You might want to check out the sectsty package and its \chapterfont macro.

enter image description here

\documentclass[final]{book}
\usepackage{lipsum,sectsty}
\chapterfont{\nohang\centering\mdseries}
\begin{document}
\chapter[Long-Titled Chapter Header]{A Very Interesting and Long Title Below the Chapter Number}
\lipsum[1-3]
\end{document} 
|improve this answer|||||
  • Thanks for suggestion, but it seems thatsectsty package does not support headings without automated chapter numbering (for example: \mylongchapter{Chapter 1}{This Chapter Have Very Interesting and Long Title Below Chapter Number}). It might not be clear from example, but I use Chapter One as text that should be printed on page and not as text for Table of Contents entry. – Rafal Jun 2 '14 at 10:13
  • 1
    @Rafal - I'm not sure I understand the nature of your concern. Using the sectsty setup mentioned in my answer, you could easily write something like \chapter*{Chapter 2\\A Very Interesting and Long Title without an Automatically Generated Chapter Number}. – Mico Jun 2 '14 at 16:03
  • You are totally right - I wasn't thinking clearly when I wrote comment above. And I figured out now that by changing chapterfont command in the preamble to \chapterfont{\nohang\centering\mdseries\baselineskip=30pt} I could control line spacing of heading as well – Rafal Jun 2 '14 at 16:29
1

You can have full control with the titlesec/titleps package:

\documentclass[11pt, final]{book}
\usepackage[utf8]{inputenc}
\usepackage{fourier, heuristica}
\usepackage{ifthen}
\usepackage{lipsum}

\usepackage{setspace}
\usepackage[clearempty, toctitles, newlinetospace, pagestyles]{titlesec}%explicit,
\titleformat{\chapter}[display]{\centering}{\LARGE\bfseries\chaptername~\thechapter}{1\baselineskip} {\onehalfspacing\Large}[\thispagestyle{basic}]
\titlespacing{\chapter}{0pt}{-2\baselineskip}{6\baselineskip}

\setheadrule{3pt}
\newpagestyle{basic}{%
\setfoot{}{\thepage}{}}

\renewpagestyle{plain}{%
\widenhead[1.5em][0pt]{0pt}{1.5em}
%\ifthechapter{\setheadrule{0pt}}{\setheadrule{0.4pt}}
\headrule
\sethead[][\small\scshape\chaptertitle][]{}{\small\itshape\sectiontitle}{}
\setfoot{}{\thepage}{}
\headrule
}
\pagestyle{plain}
\begin{document}

\chapter{This Chapter Has a Very Interesting and Long Title Below Chapter Number}

\section{First Section}
\lipsum[1-5]

\section{Second Section}
\lipsum[6-10]

\end{document} 

\documentclass[11pt, final]{book}
\usepackage[utf8]{inputenc}
\usepackage{fourier, heuristica}
\usepackage{ifthen}
\usepackage{lipsum}

\usepackage{setspace}
\usepackage[clearempty, toctitles, newlinetospace, pagestyles]{titlesec}%explicit,
\titleformat{\chapter}[display]{\centering}{\LARGE\bfseries\chaptername~\thechapter}{1\baselineskip} {\onehalfspacing\Large}[\thispagestyle{basic}]
\titlespacing{\chapter}{0pt}{-2\baselineskip}{6\baselineskip}

\setheadrule{3pt}
\newpagestyle{basic}{%
\setfoot{}{\thepage}{}}

\renewpagestyle{plain}{%
\widenhead[1.5em][0pt]{0pt}{1.5em}
%\ifthechapter{\setheadrule{0pt}}{\setheadrule{0.4pt}}
\headrule
\sethead[][\small\scshape\chaptertitle][]{}{\small\itshape\sectiontitle}{}
\setfoot{}{\thepage}{}
\headrule
}
\pagestyle{plain}
\begin{document}

\chapter{This Chapter Has a Very Interesting and Long Title Below Chapter Number}

\section{First Section}
\lipsum[1-5]

\section{Second Section}
\lipsum[6-10]

\end{document} 

enter image description here

enter image description here

enter image description here

|improve this answer|||||

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.