I want to represent the \part
in the TOC as on the figure below:
The problem is the \part
could be represented so simple as other headers. As you see in the MWE below, the \part
design has been created by same way as \section
, but the color box in not displayed in the first case:
\documentclass[a4paper,twoside]{article}
\usepackage{color}
\usepackage[svgnames,x11names,table]{xcolor}
\usepackage{tikz}
\usepackage{titletoc}
\setcounter{tocdepth}{3}
\contentsmargin{2.55em}
\titlecontents{part}[0pc]
{}
{\begin{tikzpicture}[baseline={([yshift=-.8ex]current bounding box.center)},]
\node [thick, draw=LavenderBlush4, fill=LavenderBlush1, rectangle, rounded corners] {\thecontentslabel};\end{tikzpicture}\quad}
{}
{}
\titlecontents{section}[0pc]
{}
{\begin{tikzpicture}[baseline={([yshift=-.8ex]current bounding box.center)},]
\node [thick, draw=LavenderBlush4, fill=LavenderBlush1, rectangle, rounded corners] {\thecontentslabel};\end{tikzpicture}\quad}
{}
{$\:$\titlerule[0.5pt]$\:$\small\thecontentspage}
\dottedcontents{subsection}[3.6em]{}{2.5em}{1pc}
\titlecontents*{subsubsection}[1.8pc]
{\small}{\thecontentslabel}
{}{\,---\,\thecontentspage}[\quad][]
\begin{document}
\tableofcontents
\part{A}
\section{AA}
\subsection{AAA}
\subsubsection{AAAA}
\subsubsection{AAAB}
\subsection{AAB}
\subsection{AAC}
\subsection{AAD}
\subsubsection{AADA}
\subsubsection{AADB}
\subsubsection{AADC}
\subsubsection{AADD}
\end{document}