I am struggeling with creating a seperate toc for my appendix.
This is what I currently have:
Contents
1 first section……1
2 second section…..2
List of appendices…5
This is what I'd like to achieve:
Contents
1 first section……1
2 second section…..2
List of appendices…5
plus a seperate toc for my appendix including all sections:
List of appendices
I My first appendix……5
II My second appendix…..6
This is my code so far:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage[toc,page]{appendix}
% as per https://tex.stackexchange.com/questions/100479/label-appendix-as-appendix-i-ii-iii-rather-than-appendix-a-b-and-c
\let\oldappendix\appendices
\renewcommand{\appendices}{%
\clearpage
\oldappendix
\renewcommand{\thesection}{\Roman{section}}
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
}%
% use custom names for appendices
\renewcommand{\appendixtocname}{List of appendices}
\renewcommand{\appendixpagename}{List of appendices}
\begin{document}
\tableofcontents
\section{first section}
\lipsum
\section{second section}
\lipsum
\begin{appendices}
\section{My first appendix}
\lipsum
\section{My second appendix}
\lipsum
\end{appendices}
\end{document}
Your help is highly appreciated. I've tried solving my issue with minitoc
, however I couldn't achieve what I exactly wanted. I really apologize if this is a duplicate question, but I couldn't find answers for my specific problem.
Best Answer
The separate
Toc
for the appendix entries can be achieved by letting an.app
(for example) file handle point to.toc
, i.e. at a certain point of document stopping to write to the.toc
file and everything meant for the.toc
enters the.app
file.I have defined a
\listofappendices
macro, that reuses\tableofcontents
by renaming\contentsname
and applying\@starttoc{app}
instead of\@starttoc{toc}
.Please note, that any writting attempt to the
.toc
will finally be placed in the.app
file, so if this is not desired, the file handle must be restored at the end ofappendices
; this is not yet done.Update Version with restoring the possibility to write to the original ToC after the appendices: