I want to customize my TOC starting with this example : How to customize the table of contents using TikZ?
I have done some changes, but I want more, here is my Code :
\documentclass[12pt,a4paper]{report}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage[tmargin=2cm,rmargin=4cm,lmargin=4cm,bmargin=2cm]{geometry}
\usepackage{kpfonts}
\usepackage{tikz}
\definecolor{doc}{RGB}{0,60,110}
\usepackage{titletoc}
\contentsmargin{0cm}
\titlecontents{chapter}[0pc]
{\addvspace{30pt}%
\begin{tikzpicture}[remember picture, overlay]%
\draw[fill=doc!30,draw=doc!30] (-4,-.2) rectangle (-0.5,.5);%
\pgftext[left,x=-3.7cm,y=0.2cm]{\color{white}\Large\sc\bfseries chapitre\
\thecontentslabel};%
\end{tikzpicture}\color{doc!40}\large\sc\bfseries}%
{}
{}
{\;\titlerule\;\large\sc\bfseries Page \thecontentspage
\begin{tikzpicture}[remember picture, overlay]
\draw[fill=doc!25,draw=doc!20] (2pt,0) rectangle (6,0.1pt);
\end{tikzpicture}}%
\titlecontents{section}[2.4pc]
{\addvspace{1pt}}
{\contentslabel[\thecontentslabel]{2.4pc}}
{}
{\hfill\small \thecontentspage}
[]
\titlecontents{subsection}[5pc]
{\addvspace{1pt}}
{\contentslabel[\thecontentslabel]{2.4pc}}
{}
{\hfill\small \thecontentspage}
[]
\makeatletter
\renewcommand{\tableofcontents}{%
\chapter*{%
\vspace*{-20\p@}%
\begin{tikzpicture}[remember picture, overlay]%
\pgftext[right,x=15cm,y=0.2cm]{\color{doc!30}\Huge\sc\bfseries
\contentsname};%
\draw[fill=doc!30,draw=doc!30] (13,-.75) rectangle (20,1);%
\clip (13,-.75) rectangle (20,1);
\pgftext[right,x=15cm,y=0.2cm]{\color{white}\Huge\sc\bfseries
\contentsname};%
\end{tikzpicture}}%
\@starttoc{toc}}
\makeatother
\begin{document}
\tableofcontents
\chapter{Premier Chapitre}
\section{Titre Section 1}
\subsection{Titre sous Section 1}
\subsection{Titre sous Section 1}
\chapter{Deuxième Chapitre}
\section{Titre Section 1}
\subsection{Titre sous Section 1}
\section{Titre Section 1}
\subsection{Titre sous Section 2}
\chapter*{ Bibliographie}
\addcontentsline{toc}{chapter}{Bibliographie}
\end{document}
Here is what I get :
Best Answer
\hfill
by\dotfill
to remove the grey box in front of the bibliography, you could make use of the syntax of
\titlecontents
and define a separate format for unnumbered chapters:francais
is deprecated, usefrench
instead.