I'm trying to create table of contents with hyperref and dot-filled lines. However I don't want them to be in unnumbered chapters. I couldn't find the solution for my problem from similar questions so I decided to create the a one. Here is my MWE:










\section{sec 1}

\section{sec 2}


  • Welcome to TeX SX! It can easily be done with the \titlecontents command, from package titletoc, which come with titlesec. See p. 14 of titlesec documentation.
    – Bernard
    Jun 12 '19 at 14:08
  • Follow-up question: What if I want dots also away from first numbered chapter introduction? (This is actually the problem I need to solve) Jun 12 '19 at 14:32
  • This is probably harder. Are you sure your introduction has to be numbered?
    – Bernard
    Jun 12 '19 at 14:49

Thank you for your MWE, it was a great help. Try the following changes, less any of my typos, to your MWE after the line \usepackage{hyperref}

 % then as before until

The first \addtocontents tells the ToC that chapters have no dotted leaders. The second \addtocontents tells the ToC to use the normal dotted leaders for chapters. Any fragile commands in the argument of \addtocontentshave to be\protect` ed otherwise there will be strange results.

  • Thanks for the GREAT answer, it did the thing! The only tiny problem exists anymore. Font of the dots for the chapters is different (bigger and bolded) compared to the font of the dots for the sections. Probably I have to use same font but I don't know how Jun 13 '19 at 8:21
  • Now I found the solution and I will share it here if someone will be in same situation as I was. So, to show dots in toc after chapter xxx with same font as in section: \addtocontents{toc}{\protect\renewcommand{\protect\cftchapleader}{\protect\cftdotfill{\cftdotsep}}}. Again thanks to Peter Wilson for the great answer. Without it I would have never find the solution! Jun 13 '19 at 8:45

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.