GeneralColor-Headlines

LaTeX specific issues not fitting into one of the other forums of this category.
Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm

Color-Headlines

Post by Aurora »

hi there,

I want to change the color of my headlines. Are there any packages or do I have to renew some commands?

Hope you could me.

Aurora

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Color-Headlines

Post by gmedina »

What exactly do you mean with headlines?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm

Re: Color-Headlines

Post by Aurora »

I mean things like \chapter, \section ... and the headline of the tabe of contents.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Color-Headlines

Post by localghost »

Try the packages titlesec and titletoc. These packages let you customize the headings.
Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm

Color-Headlines

Post by Aurora »

localghost wrote: Try the packages titlesec and titletoc. These packages let you customize the headings.

thanks for this links. But I didn't find help on how to color the headlines in there.
User avatar
pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm

Color-Headlines

Post by pumpkinegan »

Slightly modify the default \titleformat command with the color package:

Code: Select all

\usepackage{color}
\usepackage{titlesec}

\definecolor{webgreen}{rgb}{0,0.75,0}
\definecolor{webred}{rgb}{0.75,0,0}

\titleformat{\chapter}[display]
{\color{webred}\normalfont\huge\bfseries}{\chaptertitlename\
\thechapter}{20pt}{\Huge}

\titleformat{\section}
{\color{webgreen}\normalfont\Large\bfseries}{\thesection}{1em}{}

\begin{document}

\chapter{A chapter}
\section{A section}

\blindtext
Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm

Re: Color-Headlines

Post by Aurora »

Thank you very very much.
It works like expected.

The only thing is that the headlines now needs more space than before.
Is there an option where I can set the vertical padding of the headlines?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Color-Headlines

Post by gmedina »

Yes, there is. Read the documentation of the packages that localghost suggested.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
dimarcom
Posts: 26
Joined: Wed Mar 05, 2008 11:03 am

Color-Headlines

Post by dimarcom »

Hi,

There is a related topic called "Color-headlines" but i changed the title because it was not describing the issue properly (to my taste).

The issue is: how to get the section, subsection, subsubsection and paragraph headings to be blue.

One of the solutions what was suggested was to use the titletoc package. My problem is that I use minitoc to get a toc at each chapter, and it's incompatible with titlesec/titletoc packages...

On the web, someone suggested to have a .sty file with a fancy latex command containing @ and #6 etc.
Is there a more straightforward solution ?
I use TexnicCenter on Windows.

Thanks,
Marie.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Color-Headlines

Post by Stefan Kottwitz »

Hi Marie,

in my opinion it would be better to open a new topic instead of capturing an very old topic.
But now we are here. ;)

If you use KOMA-Script the solution could be very simple, just one line:

Code: Select all

\addtokomafont{sectioning}{\color{blue}}
But if not then my first idea would the fancy thing you mentioned. I think with @ and #6 you mean \@startsection. You don't need a sty file, you could redefine it in your preamble.

Stefan
LaTeX.org admin
Post Reply