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.

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!

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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}
share|improve this answer
    
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
add comment

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}
\addtocontents{toc}{\protect\setcounter{tocdepth}{1}}

\chapter{appch}
\section{secasdasd}
\subsection{asd}
\section{secasdfasd}
\end{document}
share|improve this answer
    
Can't get it to work, see above! Edit: The example isn't completely related since it doesn't change things for the APPENDIX ONLY! –  tim Jun 26 '11 at 15:27
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
    
Okay cool, thanks to you too, this works also pretty well :) It's a pity I can't accept two answers ;) –  tim Jun 26 '11 at 15:57
add comment

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.