[Tex/LaTex] Using scrbook, how to suppress page numbers for all but several chapters in TOC

scrbooktable of contents

I want to publish a book, and our publishing center style guide suggests the following style rules for the table of contents:

  1. Every book chapter and section must have its entry in TOC.
  2. If a book chapter doesn't have any sections, then it must have its page number in TOC, preceded by dots,
  3. If a book chapter has nested sections, then only its name without page number must be present in TOC.

So I would like to suppress page numbers for numbered chapters, and show them only for unnumbered chapters, such as Introduction and Conclusion.

The MWE is below:

\documentclass[paper=a4, 
               fontsize=14pt, 
               DIV=calc,
               twoside=false,
               headings=small,
               numbers=endperiod,
               chapterentrydots=true,
               ]{scrbook}

\begin{document}

\tableofcontents

\chapter*{Introduction}\addcontentsline{toc}{chapter}{Introduction}
\newpage
\newpage
\chapter{Chapter without page number}
\section{Section One}


\end{document}

enter image description here

Best Answer

Update

With KOMA version 3.20 (or newer) it is possible to define an own tocentry style for unnumbered chapters. So here is a new suggestion to suppress the page numbers of all numbered chapters and to insert a dotted line for the unnumbered chapter entries in TOC.

\documentclass[paper=a4, 
               fontsize=14pt, 
               DIV=calc,
               twoside=false,
               headings=small,
               numbers=endperiod,
               ]{scrbook}[2016/05/10]% needs version 3.20 or newer

\RedeclareSectionCommand[
  tocpagenumberbox=\blankbox
]{chapter}
\newcommand\blankbox[1]{}% do nothing

\DeclareTOCStyleEntry[
  level=\chaptertocdepth,
  indent=0pt,
  numwidth=1.5em,
  linefill=\TOCLineLeaderFill
]{chapter}{unnumberedchapter}
\makeatletter
  \def\toclevel@unnumberedchapter{\chaptertocdepth}% needed if hyperref is used
\makeatother

\usepackage{xpatch}
\xpatchcmd{\addchaptertocentry}
  {\addtocentrydefault{chapter}{#1}{#2}}
  {\IfArgIsEmpty{#1}
    {\addtocentrydefault{unnumberedchapter}{#1}{#2}}
    {\addtocentrydefault{chapter}{#1}{#2}}%
  }{}{\PatchFailed}

%\usepackage{hyperref}
\begin{document}
\tableofcontents
\addchap{Introduction}
\chapter{Chapter}
\section{Section One}
\end{document}

enter image description here


Original answer

With a KOMA-Script class you can use

\addchap{Introduction}

instead \chapter*{Introduction}\addcontentsline{toc}{chapter}{Introduction}.

Here is a suggestion to suppress page numbers of all numbered chapters in TOC:

\documentclass[paper=a4, 
               fontsize=14pt, 
               DIV=calc,
               twoside=false,
               headings=small,
               numbers=endperiod,
               ]{scrbook}

\setkomafont{chapterentrypagenumber}{\nullfont}

\renewcommand\addchaptertocentry[2]{%
  \IfArgIsEmpty{#1}
    {\addtocontents{toc}
        {\protect\begingroup
          \protect\setkomafont{chapterentrypagenumber}{}%
          \protect\KOMAoptions{chapterentrydots}%
        }%
      \addtocentrydefault{chapter}{}{#2}%
      \addtocontents{toc}{\protect\endgroup}%
    }
    {\addtocentrydefault{chapter}{#1}{#2}}%
}

\begin{document}
\tableofcontents
\addchap{Introduction}
\chapter{Chapter without page number}
\section{Section One}
\end{document}

enter image description here

Related Question