TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
up vote 15 down vote accepted

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.

share|improve this answer
Thanks i'll try this and ill come back if i have problems by using xcolor :) – ALdaperan Oct 7 '12 at 9:03
@ALdaperan I forgot to mention that the TOC heading is just an unnumbered chapter, so that will also be influenced by \chapterfont{\color{blue}}. – Torbjørn T. Oct 7 '12 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... – Enthusiastic Student Oct 30 '14 at 20:36
@EnthusiasticStudent Yes, it does. Do you use Book (Standard Class)? – Torbjørn T. Oct 30 '14 at 20:42
@TorbjørnT. this is in my preamble: \documentclass[a4paper,12pt,twosided,openright]{book} – Enthusiastic Student Oct 30 '14 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

share|improve this answer
Welcome to TeX.SX! Could you provide a complete example and a screen shot, to make this a real answer? – Christian Hupfer Aug 22 '14 at 10:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.