I am using Lyx and Layout report for my thesis. I would like to change the colour of chapters sections and subsections (only the headings) from black to blue.

I attach a screenshot in order to understand what colours i am trying to achieve only on headings (Chapter /section and subsection )

Also is it possible to change the colour of table of contents to blue ? (again only the heading)


2 Answers 2


You can use the package sectsty to do change the headings, and xcolor to get the colour definitions.

For example, add to your preamble (Document --> Settings --> LaTeX preamble) the following:

\chapterfont{\color{blue}}  % sets colour of chapters
\sectionfont{\color{cyan}}  % sets colour of sections

enter image description here

You can use colours predefined in xcolor (see manual), or define your own, e.g.


Put such definitions in the preamble as well.

  • Thanks i'll try this and ill come back if i have problems by using xcolor :)
    – ALdaperan
    Commented Oct 7, 2012 at 9:03
  • 1
    @ALdaperan I forgot to mention that the TOC heading is just an unnumbered chapter, so that will also be influenced by \chapterfont{\color{blue}}. Commented Oct 7, 2012 at 9:19
  • @TorbjørnT. does this also work with chapters in book style? I have changed sections with ease but it did not work for chapters...
    – enthu
    Commented Oct 30, 2014 at 20:36
  • @EnthusiasticStudent Yes, it does. Do you use Book (Standard Class)? Commented Oct 30, 2014 at 20:42
  • @TorbjørnT. this is in my preamble: \documentclass[a4paper,12pt,twosided,openright]{book}
    – enthu
    Commented Oct 30, 2014 at 20:45

This thread seems to be closed for quite a while, but as I found it right after searching for a solution some minutes ago, I just thought I could add the solution I found for solving the problem.

For all those of you who use KOMA Script Classes: its just adding one line if you are going for changing the color of all headlines during your document; be it chapters, sections, subsections and what not alltogether.

By adding


you change all the headlines to the standard font you are using during your document, and by replacing \normalcolor by anything you whish you change the color for all headlines. It workes for selfdefined colors and as the other solution it applies for the \tableofcontents, too.



Here we have an example of code in which I used that method

\documentclass[oneside, 12pt]{scrbook}
\usepackage{cancel, caption, mathtools, subcaption, amsthm}
\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}

\parindent 0pt
\parskip 6pt




\captionsetup{format=plain, labelfont={color=rahmen,bf}}

\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}


\captionsetup{format=plain, labelfont={color=schrift,bf}}


\hfuzz 100pt
\hbadness 10000

\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}


\section{Erhaltungsgr\"oßen der Zentralkraftbewegung}
\subsection{Der Lenz-Runge Vektor}

    \Lambda =   \frac{1}{m\alpha} \Big( \mathbf{p} \times \mathbf{L} \Big) - \mathbf{e}_r

Zu zeigen:

    \Lambda = \mathrm{~const.} \leftrightarrow \frac{\mathrm{d}}{\mathrm{d}t} ~\Lambda = 0

Zur Diskussion des Problems sind Zylinderkoodinaten mit konstanter Höhe erforderlich. Wähle also als Höhe $z=0$. Der Nabla-Operator in Zylinderkoordinaten hat die Form

    \boldsymbol\nabla   = \mathbf{e}_r \frac{\partial}{\partial r} + \mathbf{e}_{\varphi} \frac{1}{r} \frac{\partial}{\partial \varphi} + \mathbf{e}_z \frac{\partial}{\partial z} 

Das Keplerpotential hat die Form

    V = -\frac{\alpha}{r}

\begin{proof}[Beweis für den Lenz-Runge Vektor als Erhaltungsgröße des Keplerproblems]
    \frac{\mathrm{d}}{\mathrm{d}t} \Lambda      &= \frac{\mathrm{d}}{\mathrm{d}t} \bigg\{ \frac{1}{m\alpha} \Big(\mathbf{p} \times \mathbf{L} \Big) \bigg\} - \dot{\mathbf{e}}_r \\
                                                &= \frac{1}{m\alpha} \frac{\mathrm{d}}{\mathrm{d}t} \bigg\{ \mathbf{p} \times \mathbf{L} \bigg\} - \dot{\mathbf{e}}_r \\
                                                &= \frac{1}{m\alpha} \bigg\{ \dot{\mathbf{p}} \times \mathbf{L} + \cancel{\mathbf{p} \times \dot{\mathbf{L}}} \bigg\} - \dot{\mathbf{e}}_r 

\noindent\fcolorbox{rahmen}{grund}{\parbox{\linewidth -2\fboxsep -2\fboxrule}{%
Für die Kraft $\mathbf{F}$ folgt aus der Konservativität und dem Keplerpotential

    \mathbf{F}  = -\boldsymbol\nabla V 
                = - \bigg[\Big( \mathbf{e}_r \frac{\partial}{\partial r} + \mathbf{e}_{\varphi} \frac{1}{r} \frac{\partial}{\partial \varphi} + \mathrm{e}_z \frac{\partial}{\partial z}  \Big) \cdot \Big(-\frac{\alpha}{r} \Big) \bigg] 
                = -\mathbf{e}_r \frac{\alpha}{r^2}

    \frac{\mathrm{d}}{\mathrm{d}t} \Lambda      &= \frac{1}{m\alpha} \bigg\{ \mathbf{F} \times \mathbf{L} \bigg\} - \dot{\mathbf{e}}_r \\
                                                &= -\frac{1}{mr^2} \bigg\{ \mathbf{e}_r \times \mathbf{L} \bigg\} - \dot{\mathbf{e}}_r \\

Which produces the output

page one of two of that document

  • If you just want to change the color of the chapter, section, ..., for your KOMA script, then it is also possible to use: \addtokomafont{disposition}{\color{your_color}} This will only change the color and leave everything else (bold, italics, ...) untouched.
    – Mario
    Commented May 23, 2023 at 12:48

You must log in to answer this question.

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