0

Despite my efforts, I didn't find/understood the answer on the forum. Please forgive me if it's a duplicate.

I want to display the entire ToC using the titletoc package, including entries with and without numerotation. However, the code below display the main TOC only for entries with numerotation.

\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%Format titles , add Toc&minitoc
\usepackage{titlesec}
\usepackage{titletoc}

%Numbering to subsubsection
\setcounter{secnumdepth}{3}

\titlecontents{chapter}
[0pt]
{\bfseries\Large\addvspace{20pt}}
{\chaptername\ \thecontentslabel\space:\space}
{}
{\hfill\contentspage}

%Show subsubsection to numbered in TOC
\setcounter{tocdepth}{3}

%% Language and font encodings
\usepackage[english, french]{babel}
\begin{document}

    \title{My title}
    \author{My name}
    \tableofcontents        %Faire Table Of Content - TOC
        \setcounter{chapter}{0}
        \chapter*{Introduction}
        Blablabla       
        \chapter{Title of the chapter1 \label{chap1}}
        {\vspace*{1pc}\hrule\vspace*{1pc}}
        \startcontents[chapters]\vbox{\bf\Large}
        \printcontents[chapters]{}{-1}{\setcounter{tocdepth}{5}}\vspace*{1pc}\hrule
        \newpage
        \section{Section1}
        Blablabla
        \subsection{subsection1}
        Blablabla
\end{document}

What did I miss?

2
  • It is a well known fact that unnumbered structure units are not added to the ToC....
    – user31729
    Mar 2 '18 at 12:32
  • Well that wasn't obvious for me, and not that straightforward when I looked for the answer on the web. Mar 4 '18 at 13:23
0

After googling for a while, I simply got the answer from this discussion thread [https://latex.org/forum/viewtopic.php?t=566][1].

I just added \addcontentsline{toc}{chapter}{Introduction} in the document environment, such as :

\documentclass[11pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%Format titles , add Toc&minitoc
\usepackage{titlesec}
\usepackage{titletoc}

%Numbering to subsubsection
\setcounter{secnumdepth}{3}

\titlecontents{chapter}
[0pt]
{\bfseries\Large\addvspace{20pt}}
{\chaptername\ \thecontentslabel\space:\space}
{}
{\hfill\contentspage}

%Show subsubsection to numbered in TOC
\setcounter{tocdepth}{3}

%% Language and font encodings
\usepackage[english, french]{babel}
\begin{document}

\title{My title}
\author{My name}
\tableofcontents        %Faire Table Of Content - TOC
    \setcounter{chapter}{0}
    \chapter*{Introduction}
    Blablabla
    \addcontentsline{toc}{chapter}{Introduction}       
    \chapter{Title of the chapter1 \label{chap1}}
    {\vspace*{1pc}\hrule\vspace*{1pc}}
    \startcontents[chapters]\vbox{\bf\Large}
    \printcontents[chapters]{}{-1}{\setcounter{tocdepth}{5}}\vspace*{1pc}\hrule
    \newpage
    \section{Section1}
    Blablabla
    \subsection{subsection1}
    Blablabla
\end{document}

It actually add manually a chapter entry in the main TOC and display unnumbered entries.

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.