[Tex/LaTex] Missing dots in ToC for chapters

formattingmemoirtable of contents

I am using the starred version of \chapter and \section to avoid the numbering of chapter and section. To have the title of chapters in ToC I use \addcontentsline{toc}{<xxx>}.

This results in no dots between title of chapter and page number in the ToC.

How do I get the dots back in the line?

Best Answer

The default layout of the ToC for chapters (starred or not) under memoir is to have no dots. This is set internally by

\newcommand{\cftchapterdotsep}{\cftnodots}

If you want dots, it's best to set it to match that of the sectional unit dots, which is the same as \cftdotsep. As such, using

\renewcommand{\cftchapterdotsep}{\cftdotsep}% Chapters should use dots in ToC

works.

enter image description here

\documentclass{memoir}
\renewcommand{\cftchapterdotsep}{\cftdotsep}% Chapters should use dots in ToC
\begin{document}
\tableofcontents
\chapter{A chapter}
\chapter*{A starred chapter}
\addcontentsline{toc}{chapter}{\protect\numberline{}A starred chapter}
\section{A section}
\end{document}