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:
Open the file
preamble.tex
which we already used in this chapter. Insert this line to load thetitlesec
package:\usepackage{titlesec}
Add this command to specify layout and font of the chapter headings:
\titleformat{\chapter}[display] {\normalfont\sffamily\Large\bfseries\centering} {\chaptertitlename\ \thechapter}{0pt}{\Huge}
Now define the section heading by calling
\titleformat
again:\titleformat{\section} {\normalfont\sffamily\large\bfseries\centering} {\thesection}{1em}{}
Add this line to adjust the chapter headings spacing:
\titlespacing*{\chapter}{0pt}{30pt}{20pt}
Save
preamble.tex
and Typeset the main documentequation.tex
. Let’s see how the headings have changed: