I want to publish a book, and our publishing center style guide suggests the following style rules for the table of contents:
- Every book chapter and section must have its entry in TOC.
- If a book chapter doesn't have any sections, then it must have its page number in TOC, preceded by dots,
- 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}



! Undefined control sequence. \addchaptertocentry #1#2->\IfArgIsEmpty {#1} {\addtocontents {toc}{\protect... l.26 \addchap{Introduction} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g.,\hobx'), typeI' and the correct spelling (e.g.,I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.` Otherwise your TOC looks just great, thank you. – Andrey Sobolev Dec 02 '15 at 07:43\IfArgIsEmpty{#1}{...}{...}by\ifstr{#1}{}{...}{...}. – esdd Dec 02 '15 at 08:32colororxcolorpackage, everything breaks down. Maybe you know why? – Andrey Sobolev Dec 02 '15 at 09:13pdfcolorstackfrom.tocfile manually, but if there is a way to do this automatically, I'll be very grateful. – Andrey Sobolev Dec 02 '15 at 10:48\usekomafont, which returned a bunch of stuff related to font coloring. I changed it to\sffamily \bfseries, and everything worked out quite nicely. – Andrey Sobolev Dec 02 '15 at 11:01\protectbefore\usekomafont{disposition}. But I have changed my answer: with\protect\setkomafont{chapterentrypagenumber}{}the chapter page number gets in TOC the same font as thechapterentry. – esdd Dec 02 '15 at 14:18