GeneralAppendix not appearing in the table of contents

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
viktiglemma
Posts: 5
Joined: Tue Apr 01, 2008 3:54 pm

Appendix not appearing in the table of contents

Post by viktiglemma »

Hi,

I have a problem that my appendix does not appear in the table of contents when the appendix is in a separate .tex file.

At the end of my document I include the appendix through

Code: Select all

\include{myappendix}
and then myappendix.tex begins with

Code: Select all

\appendix
\appendixpage
\addappheadtotoc
However if I paste the whole thing into one document I get the appendix. How can I keep the documents separated and still get the appendix in the toc? Would be grateful if somebody could help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Appendix not appearing in the table of contents

Post by Stefan Kottwitz »

Hi viktiglemma,

where do you make the toc entry for the appendix? Inside your main document or inside myappendix.tex?

I remember that using \addcontentsline and \addtocontents together with \include may cause problems. One possible solution may be to put all commands that write to the toc into the included files.

Stefan
viktiglemma
Posts: 5
Joined: Tue Apr 01, 2008 3:54 pm

Appendix not appearing in the table of contents

Post by viktiglemma »

Stefan_K wrote:Hi viktiglemma,

where do you make the toc entry for the appendix? Inside your main document or inside myappendix.tex?

I remember that using \addcontentsline and \addtocontents together with \include may cause problems. One possible solution may be to put all commands that write to the toc into the included files.

Stefan
Hi and thanks for answering.

Since the appendix was included in the toc before I moved it to a separate file, I don't have a separate toc entry for the appendix. I tried to investigate \addcontentsline and \addtocontents but I do not understand how to use them to get the appendix included. How would you suggest that I write to the toc?

viktiglemma
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Appendix not appearing in the table of contents

Post by Stefan Kottwitz »

Hi,

it would be easier to help you if you provide more code (preamble, ...) or even a minimal working example.

I guess you are using the appendix package. You didn't mention it, but \addappheadtotoc should belong to it. Have a look at the documentation, 2.1 Known Problems, the problem with interaction of appendix and \include is discussed there.

Stefan
viktiglemma
Posts: 5
Joined: Tue Apr 01, 2008 3:54 pm

Re: Appendix not appearing in the table of contents

Post by viktiglemma »

Hi,

Yes, I am using the appendix package. In the documentation you linked to I read that using \input instead of \include would improve on something - and it worked in my case! My appendix is now listed finally.

Thanks for your help!


Viktiglemma
Post Reply