0

I'm facing a problem I can't resolve

How to remove appendix A,B... entries only from TOC and keep it in appendix TOC?

What I wish to do :

TABLE OF CONTENTS:

Contents

I MWE . . . . .. . . 1

1 For Tex . . . . . .2

Table des annexes 

And

TABLE DES APPENDICES :

Table des annexes

A Test 1 ................. 5

B Test 2 ................. 6

Here is MWE :

\documentclass[oneside]{book}

\usepackage{blindtext}
\usepackage{titletoc}
\usepackage{titlesec}

\begin{document}


\frontmatter
\tableofcontents

\mainmatter
\part{MWE}
\chapter{For Tex}
\Blindtext

\begingroup
    \chapter*{Table des annexes} \addcontentsline{toc}{chapter}{Table des annexes}
    \startcontents[annexes]
    \printcontents[annexes]{l}{0}{\setcounter{tocdepth}{2}} 
    \appendix % Cue to tell LaTeX that the following "chapters" are Appendices
    \chapter{Test 1}
    aze
    \chapter{Test 2}
    aze
    \stopcontents[annexes]
\endgroup


\end{document}
0

1 Answer 1

0

The only way I know to remove entries is to adjust the tocdepth counter, which would mean making the appendices use sections, subsections or some smaller subdivision.

\documentclass[oneside]{book}

\usepackage{blindtext}
\usepackage{titletoc}
\usepackage{titlesec}

\begin{document}
\setcounter{tocdepth}{0}% show only chapters

\frontmatter
\tableofcontents

\mainmatter
\part{MWE}
\chapter{For Tex}
\Blindtext

\begingroup
    \chapter*{Table des annexes} \addcontentsline{toc}{chapter}{Table des annexes}
    \startcontents[annexes]
    \setcounter{tocdepth}{1}% show sections
    \printcontents[annexes]{l}{0}{\setcounter{tocdepth}{2}} 
    \appendix % Cue to tell LaTeX that the following "chapters" are Appendices
    \renewcommand{\thesection}{\Alph{section}}%
    \section{Test 1} 
    aze
    \section{Test 2} 
    aze
    \stopcontents[annexes]
\endgroup


\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .