Time for action – designing chapter and section headings

We return to our example that we used in this chapter. Our goal is to create centered headings. The font size should be smaller, further we reduce the space above and below. Finally, we switch to a sans serif font which is a good choice for bold headings:

  1. Open the file preamble.tex which we already used in this chapter. Insert this line to load the titlesec package:
    \usepackage{titlesec}
  2. Add this command to specify layout and font of the chapter headings:
    \titleformat{\chapter}[display]
      {\normalfont\sffamily\Large\bfseries\centering}
      {\chaptertitlename\ \thechapter}{0pt}{\Huge}
  3. Now define the section heading by calling \titleformat again:
    \titleformat{\section} {\normalfont\sffamily\large\bfseries\centering} ...

Get LaTeX Beginners Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.