Problem with titleformat: Don't want Chapter Style to be Applicable on Table of Contents & Bibliography

Sandeep Singh 09/24/2018 at 04:42. 1 answers, 0 views
sectioning formatting titletoc

Please consider the following code:


   paperwidth=216mm, paperheight=303mm,
   left=23mm,  %% or inner=23mm
   right=18mm, %% or outer=18mm
   top=23mm, bottom=23mm,

%% Command to hold chapter illustration image

%% Define how the chapter title is printed
%% Background image at top of page
%% Draw a semi-transparent rectangle across the top
\tikz[overlay,remember picture]
  (current page.north west) rectangle 
  ([yshift=-3cm] current page.north east);
  %% Check if on an odd or even page
  %% On odd pages, "logo" image at lower right
  %% corner; Chapter number printed near spine
  %% edge (near the left); chapter title printed
  %% near outer edge (near the right).
    \begin{tikzpicture}[overlay,remember picture]
    \node[anchor=south west,
      at (current page.north west) 
      {\chaptername\ \thechapter};
      inner ysep=12pt, inner xsep=20pt,
      rounded rectangle,anchor=east, 
      at (current page.north east) {#1};
  %% On even pages, "logo" image at lower left
  %% corner; Chapter number printed near outer
  %% edge (near the right); chapter title printed
  %% near spine edge (near the left).
  \else {
    \begin{tikzpicture}[overlay,remember picture]
    \node[anchor=south east,
      at (current page.north east)
      {\chaptername\ \thechapter};
      inner sep=12pt, inner xsep=20pt,
      rounded rectangle,anchor=west,
      at ( current page.north west) {#1};


\chapter{Hello World!}

\chapter{Whassup, Doc?}



The Fancy Settings which I applied to "Chapters" comes over to Everything in the Document. => Table of Contents & Bibliography(not included in the sample code above) are now displayed as 'Chapters'.

Also, I have to disable:


as enabling these sections leads to compilation error (when the Chapter Settings applies to them).

Please help me find some way to avoid this problem.

1 Answers

Stefan Kottwitz 08/25/2012.

Since the table of contents comes before the numbered chapters, you could move your \titleformat and \titlespacing commands after \tableofcontents, so this won't be affected.

You could also define commands, which act like a switch: one calls \titleformat and \titlesection the fancy way, and the other calls it with default settings, which can be found in the titlesec documentation appendix. So you can switch if on and off as you like.

Here's a small example for switching styles, which can be a start for you - just changing colors:

  {\normalfont\huge\bfseries\color{blue}}{\chaptertitlename\ \thechapter}
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}


Popular Tags