87

How do I specify the fonts, and general font size, for the titles, chapters and sections in my document

Update:

I can see how my question is confusing.

I use \section and \chapter etc. to organise my document, and I would like to change the way the section and chapter titles are displayed.

1
  • 2
    The title of this post and the actual question are kind of confusing. Do you want to change the overall look of your document, or only one section? Commented Aug 10, 2010 at 20:02

2 Answers 2

80

For the standard classes titlesec would be my choice. Here's an example using titlesec and the standard formatting/spacing, except that the font is changed to Helvetica (Arial has been derived from it) and the font color for demonstration. Adjust the \titleformat arguments to achieve what you desire.

\documentclass{report} 
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{mathptmx}% Times Roman font
\usepackage[scaled=.90]{helvet}% Helvetica, served as a model for arial
\usepackage{xcolor}
\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\sffamily\huge\bfseries\color{blue}}
  {\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\section}
  {\normalfont\sffamily\Large\bfseries\color{cyan}}
  {\thesection}{1em}{}
\begin{document}
\Blinddocument
\end{document}

alt text

With KOMA-Script classes it's easy as many other issues, just use \setkomafont and \addtokomafont. Here's the example:

\documentclass{scrreprt} 
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{mathptmx}% Times Roman font
\usepackage[scaled=.90]{helvet}% Helvetica, served as a model for arial
\usepackage{xcolor}
\usepackage{titlesec}
\setkomafont{chapter}{\normalfont\huge\sffamily\bfseries\color{blue}}
\addtokomafont{section}{\color{cyan}}
\begin{document}
\Blinddocument
\end{document}

alt text

5
  • 3
    Is there a way to just adjust the color/font and keeping all the style information from the existing document class? Commented Aug 15, 2010 at 12:58
  • 1
    for KOMA, it might be better to \setkomafont{disposition}{\foo} since this works for all title commands... (It is overridden by fonts specified in the specific commands...)
    – Seamus
    Commented Mar 10, 2011 at 15:10
  • Could you, please, tell me how to put the chapter and chaptertitle higher and to change the vertical gap between them and the text?
    – filokalos
    Commented May 28, 2011 at 20:57
  • How do I apply that for all sections? In other words including subsections and subsubsections?
    – CrazyQwert
    Commented Jun 23, 2018 at 10:06
  • 1
    @CrazyQwert \titleformat{\subsection}etc.
    – Stefan Kottwitz
    Commented Jun 23, 2018 at 10:42
24

Depending on the level of customization you want, pick one of the following, in decreasing order of power/difficulty:

2
  • 10
    For the level of customization you're describing, sectsty seems to be the right balance of control and power. It gives you things like: \allsectionsfont{\sffamily} or \chapterfont{\fontfamily{phv}\selectfont} or such.
    – Lev Bishop
    Commented Aug 10, 2010 at 13:13
  • Thanks for the answer, it's a bit more power than I need right now, but it might come in later Commented Aug 11, 2010 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .