[Tex/LaTex] How to properly add ‘Appendices’ to the TOC

appendicestable of contentstocloft

I need to add 'Appendices' before Appendix A, Appendix B in the TOC. Below code successfully adds it.

\appendix

\addtocontents{toc}{\cftpagenumbersoff{chapter}} 
\chapter*{APPENDICES}
\addtocontents{toc}{\protect\contentsline {chapter}{APPENDICES}{}{}}

\addtocontents{toc}{\cftpagenumberson{chapter}} 

\makeatletter
\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}
\makeatother

\include{appendix_materials}
\include{appendix_project}

The output is as follows:

APPENDICES
  APPENDIX A
  APPENDIX B

However, \chapter*{APPENDICES} command adds an extra page and this is unwanted outcome. When the command removed output becomes as follows:

CHAPTER A
APPENDICES
  APPENDIX B

Is there any way to get rid of extra chapter page? Or mainly how to add properly 'Appendices' to the TOC?

By the way Appendix A and Appendix B added as chapter because of styling issues.

My setup:

\documentclass[12pt]{report}
\usepackage[titletoc,title]{appendix}
\usepackage{tocloft}

Best Answer

The appendix package isn't really used correctly in the 'MWE' by the O.P.

Calling \usepackage[page,toc,titletoc,title]{appendix} it is possible to have

  • A separate page titled Appendices (or Appendix, if there's only one appendix chapter or section (option page)
  • The ToC - entry Appendices for the separate Appendix - page (option toc
  • The word Appendix as a title to the chapters or sections in the document body (option title)
  • The word Appendix in the ToC as well (option titletoc)

However, this requires either the usage of multiple \addappendixpage etc. commands or \begin{appendices}...\end{appendices}.


\documentclass[12pt]{report}
\usepackage[page,toc,titletoc,title]{appendix}
\usepackage{tocloft}

\usepackage{blindtext}


\begin{document}
\tableofcontents
\chapter{Foo}

\begin{appendices}
\chapter{Foo appendix}
\chapter{Foobar appendix}
\end{appendices}
\end{document}

enter image description here

Related Question