Excluding Appendix Chapters in TOC

appendicestable of contents

I was wondering if there is any way to exclude the individual Chapters within the Appendix so that the TOC only shows one line labeled as "appendices"?

I am using the begin{appendices} as I want it to be sectioned off from my main document. I also tried using \chapter* but I want to keep the Appendix A label above the title of the appendix.

\begin{document}

\tableofcontents


\begin{appendices}

\chapter{sometext}

\chapter{somemoretext}

\end{appendices}


\end{document}

Best Answer

You can use the following setup:

enter image description here

\documentclass{report}

\usepackage{appendix}

\begin{document}

\tableofcontents

\begin{appendices}

\cleardoublepage
\addcontentsline{toc}{chapter}{Appendices}% Insert reference to Appendices in ToC
\renewcommand{\addcontentsline}[3]{}% Remove ability to add content to ToC

\chapter{sometext}

\chapter{somemoretext}

\end{appendices}

\end{document}

The idea would be to add Appendices to the ToC manually at the start of the appendices environment (either in the text, or within the preamble) and also remove the capability of adding additional content by making \addcontentsline a no-op. It will gobble its three arguments and do nothing.

Related Question