1

Using the titlesec package, any changes I make on chapter titles is reflected to the ToC title. The same is not true for changes I do on sections, subsections etc. I don't want the ToC title to be changed together with chapters. If it can't be helped, how do I change it on my own?

I made this test document with colors to demonstrate this:

\documentclass{report}
\usepackage{titlesec}
\usepackage{xcolor}

\titleformat{\chapter}
            {\normalfont\bfseries\Huge\color{orange}}
            {\color{red}\thechapter.}
            {10pt}
            {\color{green}}
    
\titleformat{\section}
            {\normalfont\bfseries\Huge\color{teal}}
            {\color{violet}\thesection.}
            {10pt}
            {\color{brown}}
            
\titleformat{\subsection}
            {\normalfont\bfseries\Huge\color{cyan}}
            {\color{yellow}\thesubsection.}
            {10pt}
            {\color{blue}}

\begin{document}
\tableofcontents

\chapter{chapter}
\section{section}
\subsection{subsection}

\end{document}

The output is:

enter image description here

enter image description here

In this example, I just want to keep the ToC title black, without changing the colors of the sectioning. As to my general question, I want to know how to keep the ToC title unaffected by any changes to the sectioning.

Thank you very much!

0

If you want the same formatting for all unnumbered chapters (list of figures, tables, bibliography, &c.), simply use the numberless key for a second \titleformat, adding these lines to your preamble:

\titleformat{name=\chapter, numberless}
 {\normalfont\bfseries\Huge}
 {}
 {0pt}
 {}
2
  • Thank you, this worked! So the ToC title is considered an unnumbered chapter? – gzarpapis Feb 25 at 11:37
  • In the report and book classes, yes. In the article class, as there are no chapters defined, it is an unnumbered section. – Bernard Feb 25 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.