0

I want to have each of my appendices in the ToC, though it somehow only shows the Appendix. I am using \usepackage{appendix}

I want it to look like this:

Appendices
A Appendix 1
B Appendix 2

At the moment it looks like this

Appendices

Relevant code:

\setcounter{tocdepth}{1}
\tableofcontents
\begin{appendix}
\appendixpage
\addappheadtotoc 
\include{Appendix}
\end{appendix}

My appendices are included in the Appendix.tex and are each a section. In the ToC all chapters and sections are included, so the tocdepth of 1 seems right to me?

  • That is not relevant code. We need a full minimal example we can copy and test as is. For example we do not know what you have in the Appendix.tex file (that include is probably not needed for this example). It might seem annoying to you that you have to do more work, but it makes helping you a lot easier for the rest of us, aka much faster answers for you. – daleif Apr 11 '18 at 9:40
0

As mentioned in the documentation of package appendix the marco \addappheadtotoc can not be followed by \include.

Use can use \input{Appendix}:

\begin{filecontents*}{Appendix.tex}
\blinddocument
\blinddocument
\end{filecontents*}
\documentclass{report}
\usepackage{blindtext}
\usepackage{appendix}
\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
\blinddocument
\begin{appendix}
\appendixpage
\addappheadtotoc 
\input{Appendix}%<- changed
\end{appendix}
\end{document}

enter image description here

Or you can put \addappheadtotoc within the included file:

\begin{filecontents*}{App.tex}
\addappheadtotoc% <- put it here
\blinddocument
\blinddocument
\end{filecontents*}
\documentclass{report}
\usepackage{blindtext}
\usepackage{appendix}
\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
\blinddocument
\begin{appendix}
\appendixpage
\include{App}
\end{appendix}
\end{document}

The result is the same as above.

If the page number of the entry »Appendix« in ToC could/should be the number of the \appendixpage then you can use:

\begin{filecontents*}{Appendix.tex}
\blinddocument
\blinddocument
\end{filecontents*}
\documentclass{report}
\usepackage{blindtext}
\usepackage{appendix}
\setcounter{tocdepth}{1}
\begin{document}
\tableofcontents
\blinddocument
\begin{appendix}
\cleardoublepage%<- added
\addappheadtotoc%<- before \appendixpage
\appendixpage
\include{Appendix}
\end{appendix}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.