Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to have two table of contents in my document. The first (main) shall only contains "Appendix A: ...", "Appendix B: ..." and so on with page numbers.
In the appendix I want another table of contents which tells me, what sections are available and on which page.

I have searched in the internet, but I couldn't find any thing matching.
I think I am not the first person trying that with LaTeX.

What is the best way to start?

EDIT:
I used now the solution from lockstep with the additional \phantomsection (Link).
Now I am searching for

... a possibility to put Heading on Level 1 under Appendix? the current situation

I think there must be a separation between the toc and the bookmarks.

share|improve this question
4  
This question may also be helpful. –  lockstep Aug 4 '11 at 16:03
    
@lockstep Thanks for your comment, I have found the original post a few days ago, but I don't get it running for me. Your solutions works fine, but is there a possibility to put Heading on Level 1 under Appendix? (Picture: img69.imageshack.us/img69/593/appendixp.jpg) –  CSchulz Aug 5 '11 at 11:42
    
@H3llGhost It seems I may have misunderstood your request. If my answer is irrelevant to the question, I'll delete it. –  Alan Munn Aug 5 '11 at 13:01
    
@Alan It seems, that your toc only shows the chapter. I want the chapters and sections and additional the point appendix but nothing from the appendices in the main toc. This is the reason why I want another toc only for the appendices. (Picture: img405.imageshack.us/img405/8079/tocx.jpg) –  CSchulz Aug 5 '11 at 15:11
    
Please make sure that all images are uploaded using the official stackexchange interface, i.e. the image icon on top of the text field (shortcut: CTRL+G). This ensures that all images are always accessible and do not expire. –  Caramdir Aug 10 '11 at 15:05

2 Answers 2

up vote 7 down vote accepted
+50

You can work with bookmarksdepth

\documentclass[toc=flat,numbers=noenddot]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\makeatletter
\newcommand*{\maintoc}{%
  \begingroup
    \@fileswfalse
    \renewcommand*{\appendixattoc}{%
      \value{tocdepth}=-10000%
    }%
    \tableofcontents%
  \endgroup
}
\newcommand*{\appendixtoc}{
  \begingroup
    \edef\@alltocdepth{\the\value{tocdepth}}%
    \setcounter{tocdepth}{-10000}%
    \renewcommand*{\contentsname}{%
      List of Appendices}%
    \renewcommand*{\appendixattoc}{%
      \setcounter{tocdepth}{\@alltocdepth}%
    }%
    \tableofcontents%
    \setcounter{tocdepth}{\@alltocdepth}%
  \endgroup
}
\newcommand*{\appendixattoc}{}%
\g@addto@macro\appendix{%
  \clearpage%
  \phantomsection%
  \addcontentsline{toc}{section}{\appendixname}%
  \addtocontents{toc}{\protect\appendixattoc}%
  \renewcommand*{\thesection}{Appendix~\Alph{section}}%
}
\makeatother

\begin{document}

\maintoc
\blinddocument

\hypersetup{bookmarksdepth=-1}
\appendix
\pdfbookmark[-1]{Appendix}{appendixentry}
\appendixtoc
\hypersetup{bookmarksdepth=4}
\blinddocument
\end{document}

enter image description here

EDIT:

You can also modify the interna of the level -- here I changed them in the following way:

\g@addto@macro\appendix{%
  \clearpage%
  \phantomsection%
  \addcontentsline{toc}{section}{\appendixname}%
  \addtocontents{toc}{\protect\appendixattoc}%
  \renewcommand*{\thesection}{Appendix~\Alph{section}}%
  \def\toclevel@chapter{1}%0
  \def\toclevel@section{2}%1
  \def\toclevel@subsection{3}%2
  \def\toclevel@subsubsection{4}%
  \def\toclevel@paragraph{5}%
  \def\toclevel@subparagraph{6}%
  \def\toclevel@figure{7}%
  \def\toclevel@table{8}%
}

The result is the same:

\documentclass[toc=flat,numbers=noenddot]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{bookmark}
\makeatletter
\newcommand*{\maintoc}{%
  \begingroup
    \@fileswfalse
    \renewcommand*{\appendixattoc}{%
      \value{tocdepth}=-10000%
    }%
    \tableofcontents%
  \endgroup
}
\newcommand*{\appendixtoc}{
  \begingroup
    \edef\@alltocdepth{\the\value{tocdepth}}%
    \setcounter{tocdepth}{-10000}%
    \renewcommand*{\contentsname}{%
      List of Appendices}%
    \renewcommand*{\appendixattoc}{%
      \setcounter{tocdepth}{\@alltocdepth}%
    }%
    \tableofcontents%
    \setcounter{tocdepth}{\@alltocdepth}%
  \endgroup
}
\newcommand*{\appendixattoc}{}%
\g@addto@macro\appendix{%
  \clearpage%
  \phantomsection%
  \addcontentsline{toc}{section}{\appendixname}%
  \addtocontents{toc}{\protect\appendixattoc}%
  \renewcommand*{\thesection}{Appendix~\Alph{section}}%
  \def\toclevel@chapter{1}
  \def\toclevel@section{2}
  \def\toclevel@subsection{3}
  \def\toclevel@subsubsection{4}
  \def\toclevel@paragraph{5}
  \def\toclevel@subparagraph{6}
  \def\toclevel@figure{7}
  \def\toclevel@table{8}
}
\makeatother

\begin{document}

\maintoc
\blinddocument

\appendix
\appendixtoc

\blinddocument
\end{document}

EDIT: Changed the order of \appendix and \pdfbookmark

share|improve this answer
    
Nearly the expected result, the only thing is that the bookmark doesn't link the page like the other bookmark does it. You can fix it with swapping \appendix and \pdfbookmark[-1]{Appendix}{appendixentry}. –  CSchulz Aug 10 '11 at 15:50
    
It seems, that \renewcommand*{\thesection}{Appendix~\Alph{section}}% doesn't work with the class scrbook. I have changed it to \renewcommand*{\thechapter}{Appendix ~\Alph{chapter}}. I get the "overfull hbox warning". –  CSchulz Aug 11 '11 at 10:43

Here's an option using the titletoc package (to build the partial ToCs), the tocvsec2 package (to control the tocdepth for the main Table of Contents), and the appendix package (to modify the way appendices appear in the main ToC):

\documentclass{scrbook}
\usepackage{titletoc}
\usepackage{tocvsec2}
\usepackage[title,titletoc]{appendix}
\usepackage{hyperref}

\begin{document}

\hypersetup{bookmarksdepth=4}
\tableofcontents
\chapter{First regular chapter}
\section{Section one one}
\subsection{Subsection one one one}
\chapter{Second regular chapter}
\section{Section two one}
\subsection{Subsection two one one}

\begin{appendices}
\settocdepth{chapter}
\addtocontents{ptc}{\setcounter{tocdepth}{3}}
\chapter{First Appendix}
\startcontents[sections]
\printcontents[sections]{}{1}{}
\section{First section in appendix one}
\subsection{First subsection in appendix one one}
\subsubsection{First subsubsection in appendix one one one}
\section{Second section in appendix one}
\subsection{First subsection in appendix one two}
\stopcontents[sections]
\chapter{Second Appendix}
\startcontents[sections]
\printcontents[sections]{}{1}{}
\section{First section in appendix two}
\section{Second section in appendix two}
\stopcontents[sections]
\end{appendices}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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