0

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?

  • If you are using a KOMA class \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 https://tex.stackexchange.com/q/45672/35864, https://tex.stackexchange.com/q/11668/35864, https://tex.stackexchange.com/q/35433/35864, https://tex.stackexchange.com/q/199071/35864 – moewe May 30 '18 at 13:42
  • See also https://tex.stackexchange.com/q/434166/35864 – moewe May 30 '18 at 16:55

2 Answers2

2

To avoid the page number in the ToC you can add the ToC entry manually with \addtocontents:

\documentclass{book}
\newcommand\fakechapter[2][]{%
  \ifx&#1&%
    \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}

enter image description here

  • I discovered that\contentsline used as above will result in trouble when used with hyperref (https://tex.stackexchange.com/questions/589153/extra-curly-bracket-error-when-using-contentsline-and-hyperref/590332#590332). \contentsline takes four arguments and hyperref will abort the build if they're not all there. – Frotz Mar 29 '21 at 00:48
1

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 - edited brackets    
Summary of the thesis.
\chapter{One}
Your thesis ...
\end{document}
Dadal
  • 3
Peter Wilson
  • 28,066