Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing on a larger probject and I want to have colored headings (the part title and the chapter title, but not the section and subsection and so on). In the toc, I also want the part and the chapter headings e.g. to be blue, but also not the section subsection and so on. I tried

    \addtokomafont{disposition}{\color{blue}}
    \addtokomafont{sectionentry}{\color{black}} 
    \addtokomafont{section}{\color{black}}

And I read also something about manipulating the \titleformat command. But I did not get it how to get this running. Would be nice if you can help me.

Here is my code:

\documentclass{book}
\usepackage{geometry}
\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm} 
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages} 
%,bookmarksopenlevel={1}
%\usepackage[hidelinks,bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,colorlinks=true,linkcolor=black,]{hyperref}
\usepackage[colorlinks,linkcolor=black,bookmarksopen=false,
hypertexnames=TRUE,pdfpagelabels=true]{hyperref}[2011/02/05]
\hypersetup{ 
  pdftitle={},
%  pdfauthor={},
  pdfsubject={Statistics Book}, 
  pdfkeywords={}, 
  }
\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
\usepackage{type1cm}         
\usepackage{zref-abspage}
\usepackage{makeidx}        
\usepackage{graphicx}        
\usepackage{multicol}        
\usepackage[bottom]{footmisc}
\usepackage{tocstyle}
\usetocstyle{allwithdot} 
\usepackage{shadethm}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{marginnote}
\usepackage{wrapfig}
\usepackage{paralist}
\usepackage{amssymb}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{ulem}

\definecolor{shadethmcolor}{rgb}{.9,.9,.95}%

\newtheoremstyle{mystyle}
  {\topsep}{\topsep}{}{}%
  {\bfseries}{:}{.5em}{}%

\theoremstyle{mystyle}

\newmdtheoremenv[hidealllines=true,backgroundcolor=shadethmcolor,skipabove=\topsep,
skipbelow=\topsep]{example}{example}

\begin{document}
\frontmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength{\marginparwidth}{2.1cm}
\marginparsep = -4pt
\pagestyle{plain}
\pagenumbering{Roman}
\include{dedic}
\newpage\section*{} 
\include{foreword}
\newpage\section*{} 
\include{preface}
\newpage\section*{} 
\include{acknow}
\newpage\section*{} 
\include{acronym}
%
\
\shorttableofcontents{Inhalts\"ubersicht}{1}
\bookmark[page=15,rellevel=1,keeplevel,view={XYZ},color=red]{Inhalts\"ubersicht}
\bookmark[page=17,rellevel=1,keeplevel,view={XYZ},color=red]{Inhaltsverzeichnis}
\tableofcontents
\clearpage
\pagenumbering{arabic}  
%



\mainmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{part1} 
\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{part2}
\include{chapter4}
\include{chapter5}
\include{chapter6}
\backmatter

\appendix 

\include{appendix}

\listoffigures
\newpage
\listoftables
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\include{glossary}
%\include{solutions}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{Index}
\printindex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{\"Uber den Autor}
\includepdf{ueberautor}
\includepdf{back}
\end{document}

Thanks a lot!

share|improve this question

closed as too localized by Marco Daniel, percusse, Claudio Fiandrino, Stefan Kottwitz Mar 3 '13 at 15:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
\addtomomafont needs a KOMA-Script class like scrbook. You have used book. –  Kurt Sep 3 '12 at 13:12
    
Do you want just the titles to be colored or the complete heading (title and number and label i.e., the word "Kapitel")? –  Gonzalo Medina Sep 3 '12 at 13:33
    
yeah, the complete heading! Thanks! –  HFDuser Sep 3 '12 at 13:36
    
please, I really need this! –  HFDuser Sep 3 '12 at 15:55