27
votes

How can I change the \section{} style? Especially I want to change the color of section heading.

I happen to find some neat style following Edward R. Tufte (http://code.google.com/p/tufte-latex/), and I'm trying to find a way to modify the section color.

Added

color package works fine, but the thing is that the color chapter number is not changed.

\section{\color{Red}ELPA}

http://img175.imageshack.us/img175/4134/screenshot20100718at417.png

4

4 Answers

30
votes

Use package titlesec.

Put this in the LaTeX header (before \begin{document})

\usepackage{titlesec}

\titleformat{\section}
{\color{red}\normalfont\Large\bfseries}
{\color{red}\thesection}{1em}{}
6
votes
\usepackage{sectsty}
%\allsectionsfont{\color{blue}\itshape\underline}
\sectionfont{\color{blue}\itshape\selectfont}
\subsectionfont{\color{green}\itshape\selectfont}

I could change color using sectsty style.

2
votes

Have you tried using the color package?

\usepackage[usenames, dvipsnames]{color}

\section{\color{Red} Section Header}

You can also define your own colors:

\usepackage[usenames, dvipsnames]{color}
\definecolor{MetallicGold}{RGB}{212, 175, 55}

\section{\color{MetallicGold} Section Header}

You can define a command to make it simplier to type:

\usepackage[usenames, dvipsnames]{color}
\definecolor{MetallicGold}{RGB}{212, 175, 55}
\newcommand{\coloredsection}[2]{\section{\color{#1} #2} }

\coloredsection{MetallicGold}{Section Header}
1
votes

You could use the titlesec package and its \titleformat command.