O'Reilly logo

LaTeX Beginners Guide by Stefan Kottwitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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} ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required