Change Colour on Chapter/Section headings {Lyx}
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:
\usepackage{xcolor}
\usepackage{sectsty}
\chapterfont{\color{blue}} % sets colour of chapters
\sectionfont{\color{cyan}} % sets colour of sections
You can use colours predefined in xcolor
(see manual), or define your own, e.g.
\definecolor{MyBlue}{rgb}{0.1,0.1,1}
Put such definitions in the preamble as well.
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
\setkomafont{disposition}{\normalcolor\bfseries}
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.
Example
\definecolor{schrift}{RGB}{0,73,114}
\setkomafont{disposition}{\color{schrift}\bfseries}
Here we have an example of code in which I used that method
\documentclass[oneside, 12pt]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{cancel, caption, mathtools, subcaption, amsthm}
\usepackage[usenames,dvipsnames]{color}
\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}
\parindent 0pt
\parskip 6pt
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother
\fboxrule0pt
\definecolor{rahmen}{RGB}{0,73,114}
\definecolor{grund}{RGB}{238,241,251}
\definecolor{schrift}{RGB}{0,73,114}
\captionsetup{format=plain, labelfont={color=rahmen,bf}}
\SetSymbolFont{letters}{normal}{OML}{cmbr}{m}{it}
\SetSymbolFont{operators}{normal}{OT1}{cmbr}{m}{n}
\SetSymbolFont{symbols}{normal}{OMS}{cmbr}{m}{n}
\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}
\setkomafont{disposition}{\color{schrift}\bfseries}
\captionsetup{format=plain, labelfont={color=schrift,bf}}
\allowdisplaybreaks
\hfuzz 100pt
\hbadness 10000
\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}
\begin{document}
\chapter{Zentralkraftbewegungen}
\section{Erhaltungsgr\"oßen der Zentralkraftbewegung}
\subsection{Der Lenz-Runge Vektor}
\begin{equation}
\Lambda = \frac{1}{m\alpha} \Big( \mathbf{p} \times \mathbf{L} \Big) - \mathbf{e}_r
\end{equation}
Zu zeigen:
\begin{equation*}
\Lambda = \mathrm{~const.} \leftrightarrow \frac{\mathrm{d}}{\mathrm{d}t} ~\Lambda = 0
\end{equation*}
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
\begin{equation}
\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}
\end{equation}
Das Keplerpotential hat die Form
\begin{equation}
V = -\frac{\alpha}{r}
\end{equation}
\begin{proof}[Beweis für den Lenz-Runge Vektor als Erhaltungsgröße des Keplerproblems]
\begin{align*}
\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
\end{align*}
\noindent\fcolorbox{rahmen}{grund}{\parbox{\linewidth -2\fboxsep -2\fboxrule}{%
Für die Kraft $\mathbf{F}$ folgt aus der Konservativität und dem Keplerpotential
\begin{equation}
\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}
\end{equation}
}}
\begin{align*}
\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 \\
\end{align*}
\end{proof}
\end{document}
Which produces the output