I'm working in sharelatex and a requirement for my thesis is a summary in the ToC which is an unnumbered chapter and without page number. Now, I fixed the numberless chapter, but there is no documentation of latex of excluding the page number for a single chapter in the ToC. Is this possible?
To avoid the page number in the ToC you can add the ToC entry manually with \addtocontents
:
\documentclass{book}
\newcommand\fakechapter[2][]{%
\ifx&%
\fakechapter[#2]{#2}%
\else
\chapter*{#2}%
\chaptermark{#1}%
\addtocontents{toc}{\protect\contentsline{chapter}{#1}{}}%
\fi
}
\begin{document}
\tableofcontents
\fakechapter{Abc}
\chapter{Def}
\fakechapter[Something]{Ghi}
\end{document}
If you are using the memoir
class (which caters for the book
, report
, and article
classes) you can do this:
\documentclass[...]{memoir}
\begin{document}
\frontmatter
\tableofcontents*
\mainmatter
\chapter*{Summary} % No ToC entry
\addtocontents{toc}{\cftpagenumbersoff{chapter}} % no chapter page numbers
\addcontentsline{toc}{chapter}{Summary} % put Summary chapter title in ToC
\addtocontents{toc}{\cftpagenumberson}{chapter}} % chapter page numbers printed
Summary of the thesis.
\chapter{One}
Your thesis ...
\end{document}
\addchap{Foo}
otherwise you need\newcommand*{\fakeaddchap}[1]{\chapter*{#1}\addcontentsline{toc}{chapter}{#1}\chaptermark{#1}}
(that could be made nicer: should be aware of the optional argument etc., etc.) See also tex.stackexchange.com/q/45672/35864, tex.stackexchange.com/q/11668/35864, tex.stackexchange.com/q/35433/35864, tex.stackexchange.com/q/199071/35864 – moewe May 30 '18 at 13:42