# Enumerate subsection, but don't print at TOC

what I try to achieve is the following: I want all subsections in the appendix have 'normal' numbers (as they currently have), but I don't want them to be displayed in the TOC. When using \subsection*{}, they are not displayed in the TOC but neither have they numbers...

Further, if possible: It would though still be nice if they are included in the TOC of the PDF-Viewer (in contrast to the TOC which is really 'printed') Thanks!

EDIT: Can't get your suggestion to work Tobi:

\documentclass{book}
\begin{document}
\tableofcontents

\chapter{bla}
\section{blipp}
\subsection{blupp}

\setcounter{secnumdepth}{2}% number \part and \chapter in book classes
\addtocounter{tocdepth}{-1}% “delete” lowest level from TOC
\appendix
\chapter{appch}
\section{secasdasd}
\subsection{asd}
\section{secasdfasd}
\end{document}


EDIT2: @Gonzalo: Since I was asking for a working example for subsectioning, I just modified your WORKING Example for this purpose:

\documentclass{book}
\usepackage{tocvsec2}
\usepackage[bookmarksdepth=subsection]{hyperref}

\begin{document}
\tableofcontents
\chapter{Test chapter}
\section{Test section one}
\subsection{Test subsection one}

\appendix
\chapter{Test Appendix}
\settocdepth{section}
\section{Test section one}
\subsection{Test subsection one}
\section{Test section one}
\subsection{Test subsection one}
\end{document}


Thanks for providing it!

-

You can use \settocdepth from the tocvsec2 package to change the value of tocdepth just for the appendix; for the bookmarks, you can set the bookmarksdepth option from hyperref:

\documentclass{book}
\usepackage{tocvsec2}
\usepackage[bookmarksdepth=section]{hyperref}

\begin{document}
\tableofcontents
\chapter{Test chapter}
\section{Test section one}
\appendix
\chapter{Test Appendix}
\settocdepth{chapter}
\section{Test section one}
\section{Test section one}
\end{document}

-
Thanks, but this will also exclude them from the PDF-toc. But thanks though, this is better than nothing, the PDF-TOC isn't that important! – tim Jun 26 '11 at 15:18
@Marc Edlo: See my answer which provides everything you need, I guess … – Tobi Jun 26 '11 at 15:20
Thanks, it works nicely! Provided small editioned version above just to match my exact question! – tim Jun 26 '11 at 15:37

You can change the counters secnumdepth and/or tocdepth—even in the document, i. e. befor \appendix

secnumdepth controls which section levels get a number and
tocdepth says which go to the TOC

Examples:

\setcounter{secnumdepth}{1}% number \part and \chapter in book classes
\addtocounter{tocdepth}{-1}% “delete” lowest level from TOC


I don’t know a way of changing the PDF-TOC seperatly but have a look at hyperref and it’s manual.

## Update

hyperref has an option bookmarksdepth for setting the depth of PDF-TOC

Edit: Here is an example showing all of the above mentioned solutions:

\documentclass{book}

\usepackage[bookmarksdepth=2]{hyperref}

\begin{document}
\tableofcontents

\chapter{bla}
\section{blipp}
\subsection{blupp}

\appendix
\setcounter{secnumdepth}{1}

@Marco Edlo: I’m sorry, Thought I used it in this was earlyer. I changed my example so it should work now. The problem was (is) that tocdepth is evaluated in \tableofcontents only so we have to put it to the toc-file with \addcontents. – Tobi Jun 26 '11 at 15:47