如何在classicthesis中拆分目录:主目录仅显附录标题,附录前设独立目录
解决classicthesis拆分目录的需求
要实现主目录仅显示附录标题,附录前添加独立的详细子目录,可以借助KOMA类自带的tocbasic工具包创建独立目录,同时通过\addtocontents控制主目录的显示级别。以下是修改后的完整MWE:
\documentclass[paper=a4, fontsize=11pt, titlepage, headinclude, footinclude, numbers=noenddot, cleardoublepage=empty]{scrreprt} \usepackage[eulerchapternumbers, beramono, eulermath, pdfspacing]{classicthesis} \usepackage{blindtext} % KOMA类自带工具,用于创建独立目录 \usepackage{tocbasic} \begin{document} % 主目录:默认显示到子章节级别 \pagestyle{scrheadings} \pdfbookmark[1]{\contentsname}{tableofcontents} \setcounter{tocdepth}{2} \manualmark \markboth{\spacedlowsmallcaps{\contentsname}}{\spacedlowsmallcaps{\contentsname}} \tableofcontents \automark[section]{chapter} \renewcommand{\chaptermark}[1]{\markboth{\spacedlowsmallcaps{#1}}{\spacedlowsmallcaps{#1}}} \renewcommand{\sectionmark}[1]{\markright{\textsc{\thesection}\enspace\spacedlowsmallcaps{#1}}} \part{Main Text} \blinddocument \part{Appendices} % 通知主目录:后续附录内容仅显示章节标题(不展开子章节) \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} % 定义独立的附录详细目录格式 \DeclareNewTOC[ type=chapter, name=附录详细目录, listname=附录详细目录, tocentryindent=0pt, tocentrynumwidth=2.3em, tocfileext=apptoc ]{apptoc} % 生成附录详细目录 \cleardoublepage \phantomsection \pdfbookmark[1]{附录详细目录}{appendix-toc} \manualmark \markboth{\spacedlowsmallcaps{附录详细目录}}{\spacedlowsmallcaps{附录详细目录}} \listofapptoc % 进入附录模式,设置附录目录显示到子章节级别 \appendix \addtocontents{apptoc}{\protect\setcounter{tocdepth}{2}} \blinddocument \end{document}
关键步骤说明
- 控制主目录显示级别:
\addtocontents{toc}{\protect\setcounter{tocdepth}{0}}会在主目录中临时将显示层级改为0(仅章节),因此附录的子章节不会出现在主目录里。 - 创建独立附录目录:通过
\DeclareNewTOC定义一个独立的目录文件(后缀为apptoc),避免和主目录的.toc文件冲突,同时继承classicthesis的排版风格。 - 生成附录详细目录:
\listofapptoc生成单独的附录目录,通过\addtocontents{apptoc}{\protect\setcounter{tocdepth}{2}}确保附录的子章节都能显示在这个独立目录中。
内容的提问来源于stack exchange,提问作者donnek
相关产品推荐
相关产品推荐

