2

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?

1
  • You should use \setcounter{secnumdepth}{-1} instead of \chapter* and \section* all over. In this way you'll need no explicit \addcontentsline.
    – egreg
    Oct 8, 2014 at 8:17

1 Answer 1

7

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}
3
  • However, in your screenshot there aren't dots for the last level of headings for an entry. How to fix that? Jan 1, 2016 at 4:30
  • @Zelphir: What do you mean by "last level"?
    – Werner
    Jan 1, 2016 at 9:45
  • For example there is the following: 1 A chapter instead of 1. A chapter For me this sounds wrong. I don't know how it is in English, but at least in German you'd rather say "First ... A chapter", so you'd use an ordinal number, instead of just a number. That's why I'd like to have a dot there. Also I think it's more logical: "The first chapter is A chapter" (in that order, reading from left to right) instead of "One chapter is A chapter." not including any indication that the number stands for a rank within the chapter hierarchy. Jan 1, 2016 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .