目录和章节标题颜色

目录和章节标题颜色

我正在编写一个较大的项目,我想使用彩色标题(部分标题和章节标题,但不包括章节和子节等)。在目录中,我还希望部分和章节标题为蓝色,但不包括章节子节等。我试过了

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

我还读了一些关于操作 \titleformat 命令的内容。但我不知道如何运行它。如果你能帮助我,那就太好了。

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}

多谢!

相关内容