I need a table of contents at the beginning of my appendix section. However, the following includes sections from the main text as well


How can I get rid of those sections from the main text and just keep the ones from the appendix?

1 Answer 1


Background: It is quite logical that the table of contents is just created for the entire file, since every chapter/section/subsection/etc. are written to a .toc file and the \tableofcontents command just reads from that file (this is also thereason why you have to compile twice in order for the toc to be included correctly.

Now, to solve your question, you can use the minitoc package like this:


% Make the "Part I" text invisible
\renewcommand \thepart{}
\renewcommand \partname{}

\doparttoc % Tell to minitoc to generate a toc for the parts
\faketableofcontents % Run a fake tableofcontents command for the partocs

\part{} % Start the document part
\parttoc % Insert the document TOC

First content.
Second content.

\addcontentsline{toc}{section}{Appendix} % Add the appendix text to the document TOC
\part{Appendix} % Start the appendix part
\parttoc % Insert the appendix TOC

\section{Appendix First}
Appendix first content.
\section{Appendix Second}
Appendix second content.

  • This method also generates a context for the main text. How can I avoid generating a context for the main text?
    – GoingMyWay
    Jan 24, 2023 at 6:51
  • @GoingMyWay Sorry haven't really touched LaTeX in a while, so can't really help you out :S
    – Foitn
    Feb 3, 2023 at 12:12
  • 4
    Remove "\parttoc" in the main text from the above will do the trick.
    – vinson
    May 8, 2023 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .