0

This question is the equivalent to Using scrbook, how to suppress page numbers for all but several chapters in TOC?, but refers to the book document class.

The question is, how to suppress page numbers for certain chapters in ToC? Using package tocloft one can call \cftpagenumbersoff{chapter}, but this command will suppress page number for every chapter.

A solution to this question would be useful for typesetting the table of contents when chapters do not bear significant text after the title, but only introduce sections (say).

The soultion should possibly work selectively for different parts of the book if needed, and should be compatible with "modified" scopes, such as appendices.

enter image description here


MWE

\documentclass[11pt, twoside, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{tocloft}
%\cftpagenumbersoff{chapter}
\begin{document}
\tableofcontents
\chapter*{Chapter}
\addcontentsline{toc}{chapter}{Chapter with page number}

\chapter{Chapter that should have no page number}
\section{First section}

\appendix
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendix (with or w/o p. number)}

\end{document}
1

This is possible adding the line

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

just before opening the chapter, as in the MWE below, where the page number whas then reactived (\cftpagenumberson). [see the tocloft manual, p. 12]

\documentclass[11pt, twoside, openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{tocloft}
%\cftpagenumbersoff{chapter}
\begin{document}
\tableofcontents
\chapter*{Chapter}
\addcontentsline{toc}{chapter}{Chapter with page number}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\chapter{Chapter that should have no page number}

\section{First section}

\appendix
\addtocontents{toc}{\cftpagenumberson{chapter}}
\chapter*{Appendix}
\addcontentsline{toc}{chapter}{Appendix (with or w/o p. number)}

\end{document}

enter image description here

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.