I am using the book document class and I want to produce a document with several parts, chapters, sections, sections and subsections. I would like to make it easier for the reader by coloring everything with respect to parts. For instance, I would like:
- The title for Part A to be blue
- The chapter titles inside Part A to be blue
- All the heading for the chapter titles in Part A to be blue
and then..
- The title for Part B to be red
- The chapter titles inside Part B to be red
- All the heading for the chapter titles in Part B to be red
etc..
Would anybody be able to help with something like that? Thanks a lot in advance!
PS. The beginning of my document looks like this:
\documentclass[11pt,letterpaper]{book}
\usepackage{amsfonts,amsthm,amssymb}
\usepackage[tbtags]{amsmath}
\usepackage{color}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[LE,RO]{\slshape\thepage}
\fancyhead[RE]{\slshape \leftmark}
\fancyhead[LO]{\slshape \rightmark}
\renewcommand{\thepart}{\Alph{part}}
\renewcommand{\thechapter}{\Roman{chapter}}
Best Answer
Here' a possible solution using the titlesec package to add the color to the chapter headings; the color for the part headings (and their ToC entries) was added through a redefinition of the internal macros
\part
,\@part
and\@spart
; the color for the chapter entries in the ToC was achieved by redefining\@chapter
. The color schema was implemente through a simple\ifcase
:Here are some pages of the final document:
And an image of the ToC:
Just as a personal comment, this coloring schema has to be handled very carefully (selecting the appropriate colors is crucial) in order not to become distracting and to avoid achieving an unpleasant layout.