Designing headings
In Chapter 2, Formatting Text and Creating Macros, we encountered the problem of customizing headings. There has to be a consistent way to modify the font of headings, their spacing, and their numbering for the whole document. Fortunately, there's a handy package for that, and it's called titlesec
. We shall use it now to design chapter and section headings.
We'll return to the example that we used in this chapter. Our goal is to create headings with this appearance:
- Centered titles
- Smaller font size
- Less space above and below
- With a sans serif font, which is a good choice for bold headings
Let's start:
- Open the
preamble.tex
file, which we have already used in this chapter. Insert this line to load thetitlesec
package:\usepackage{titlesec}
- Add this command to specify the layout and font of the chapter headings:
\titleformat{\chapter}[display] {\normalfont\sffamily\Large\bfseries\centering...