[Tex/LaTex] Separate table of contents for appendix

appendicesscrbooktable of contents

We are working on a book (class scrbook) where we would like to have two separate table of contents: one at the beginning of the document for the actual "content" of the book and another one just before the first chapter of the appendix starts, which only contains the chapters and sections of the appendix. The appendix itself shall not appear in the main table of contents.
(background: the content of the book will be printed, while the appendix will only be available online as a PDF file)

Something like that:

Table of Contents
1   First chapter .... 1
1.1 A section ........ 2

First chapter
text text text

A section
text text text

Appendix
1   Something ....... 5
1.1 Specific ........ 6

Appendix A
Something
text text text

A.1 Specific
text text text

I am a bit confused by the possibilities given by different packages like "appendix", "titletoc", "tocloft", …

Does anyone know how to achieve this?

Best Answer

Here is a solution using etoc package

\documentclass{scrbook}
\usepackage{etoc}

\begin{document}
\etocdepthtag.toc{mtchapter}
\etocsettagdepth{mtchapter}{subsection}
\etocsettagdepth{mtappendix}{none}
\tableofcontents‎‎
\chapter{First chapter}
text text text

\section{A section}
text text text

\subsection{A subsection}
text text text

\appendix

\etocdepthtag.toc{mtappendix}
\etocsettagdepth{mtchapter}{none}
\etocsettagdepth{mtappendix}{subsection}
\tableofcontents‎‎
\chapter{Appendix A}
text text text

\section{Specific}
text text text

\subsection{A subsection}
text text text

\end{document}