我面临一个无法解决的问题
如何从目录中删除附录 A、B......条目并将其保留在附录目录中?
我希望做的是:
目录:
Contents
I MWE . . . . .. . . 1
1 For Tex . . . . . .2
Table des annexes
和
附录表:
Table des annexes
A Test 1 ................. 5
B Test 2 ................. 6
以下是 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}
答案1
我知道的删除条目的唯一方法是调整目录深度计数器,这意味着让附录使用章节、小节或一些更小的细分。
\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}