0

In the example below, I would :

  1. Add dots after each chapter in the main table of contents

  2. Indent a little more each chapter line in the table of contents

But when I try to add :

\usepackage{tocloft}
\cftsetindents{chapter}{0.5in}{0.2in} %PROBLEME
\renewcommand\cftchapdotsep{\cftdotsep}%

then a buggy line appears at the end of each toc of each section, such as this :

2 C2 . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  7

How to solve this ?

Thanks.

Here is a example.

\documentclass[a4paper,11pt]{book}

%compilation XeLaTeX
\usepackage[tuenc]{fontspec}
%
%compilation LaTeX
%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}

\usepackage[french]{babel}

\usepackage{titlesec,titletoc}
\usepackage{tocloft} %PROBLEME
\cftsetindents{chapter}{0.5in}{0.2in} %PROBLEME
\renewcommand\cftchapdotsep{\cftdotsep} %PROBLEME

\begin{document}


\tableofcontents
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}

\titleformat{\chapter}
  {\normalfont\Huge\bfseries\boldmath}
  {Chapitre \arabic{chapter} :}
  {1em}
  {}
\titlespacing*{\chapter}{0pt}{0pt}{30pt}


\part{Partie 1}

\chapter{C1}

\startcontents[chapters]
\printcontents[chapters]{}{1}{\addtocontents{ptc}{\protect\setcounter{tocdepth}{1}}}

\section{S1}

\section{S2}

\section{S3}

Blabla

\chapter{C2}

\startcontents[chapters]
\printcontents[chapters]{}{1}{\addtocontents{ptc}{\protect\setcounter{tocdepth}{1}}}

Blabla

\part{Partie 2}

\end{document}
  • 1
    Titlesec/titletoc and tocloft are not compatible – user31729 Aug 27 '17 at 14:03
  • Thank you ; I found a solution with \dottedcontents{chapter}[3.8em]{}{2.3em}{1pc}, but now I have a new problem posted here : [tex.stackexchange.com/questions/388485/… ... – Oli Aug 27 '17 at 16:41
  • No idea, please ? – Oli Sep 1 '17 at 19:22

Your Answer

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

Browse other questions tagged or ask your own question.