[Tex/LaTex] Chapters without dots in ToC

koma-scripttable of contents

I've used this code

\addtocontents{toc}{\cftpagenumbersoff{chapter}}

to remove the dots and page numbers after the entries in my ToC for all chapters. Is there a way to do this just for an arbitrary chapter?

The following is essentially the code I have.

\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
                footinclude=true,cleardoublepage=empty, abstractoff, 
                BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
                ngerman,american
                ]{scrreprt}

\usepackage{tocloft}

\addtocontents{toc}{\cftpagenumbersoff{chapter}} 

\begin{document}

\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} 
\tableofcontents

\chapter{Test Chapter One}

\index{arte}
\section{Section One One}
\section{Section One Two}
\chapter{Test Chapter Two}
\section{Section Two One}
\section{Section Two Two}

\end{document}

The result is this

enter image description here

What I want is, for instance, only Test Chapter Two with dots after the title.

In particular is there a way to make the dots appear when the chapter has no sections?

Best Answer

Just put the toggles \addtocontents{toc}{\cftpagenumbersoff{chapter}} and \addtocontents{toc}{\cftpagenumberson{chapter}} when and where you need it.

\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
                footinclude=true,cleardoublepage=empty, abstractoff, 
                BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
                ngerman,american
                ]{scrreprt}

\usepackage{tocloft}


\begin{document}

\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} 
\tableofcontents

\chapter{Test Chapter One}

\index{arte}
\section{Section One One}
\section{Section One Two}

\addtocontents{toc}{\cftpagenumbersoff{chapter}} 
\chapter{Test Chapter Two}
\section{Section Two One}
\section{Section Two Two}

\addtocontents{toc}{\cftpagenumberson{chapter}} 
\chapter{Test Chapter Three}
\section{Section Three One}
\section{Section Three Two}

\end{document}

enter image description here


And if for some reason you wanted the page number, but not the dots, for a single entry, try this:

\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
                footinclude=true,cleardoublepage=empty, abstractoff, 
                BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
                ngerman,american
                ]{scrreprt}

\usepackage{tocloft}


\begin{document}

\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} 
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} 
\tableofcontents

\chapter{Test Chapter One}

\index{arte}
\section{Section One One}
\section{Section One Two}

\addtocontents{toc}{\def\protect\cftdotsep{10000}} 
\chapter{Test Chapter Two}
\addtocontents{toc}{\def\protect\cftdotsep{4.5}} 
\section{Section Two One}
\section{Section Two Two}

\chapter{Test Chapter Three}
\section{Section Three One}
\section{Section Three Two}

\end{document}

enter image description here

Related Question