Closed TesiLin closed 5 months ago
我们学院要求final版本的目录中,paper和proposal两部分的目录级别不同。 其中,paper部分的目录与现有的一致,但proposal的目录应该仅到下图所示的层级,也就是chapter等级。
参考了Switching tocdepth in the middle of a document,在zjuthesis中应当修改的东西如下:
config/commands.tex,增加命令
\newcommand{\changelocaltocdepth}[1]{% \addtocontents{toc}{\protect\setcounter{tocdepth}{#1}}% \setcounter{tocdepth}{#1}% }
zjuthesis.tex,修改\newcommand{\inputundergraduate}中\equal{\Period}{final},在proposal部分增加一行\changelocaltocdepth{0}。完整如下:
\newcommand{\inputundergraduate}
\equal{\Period}{final}
\changelocaltocdepth{0}
\ifthenelse{\equal{\Period}{final}} { % Final thesis % Final part \newcommand{\undergradcurrstage}{final} \newrefsection \coverstyle \inputpage{final}{cover} \prevstyle \inputpage{final}{previous} \inputpage{final}{toc} \bodystyle \inputpage{final}{cover-part} \resetpagecounter{} \inputbody{final/content} \inputbody{final/post} \poststyle \inputpage{final}{post} % Proposal part \renewcommand{\undergradcurrstage}{proposal} \newrefsection \changelocaltocdepth{0} % 使得第二部分只输出第一级标题 \coverstyle \inputpage{proposal}{cover-part} \inputpage{proposal}{cover} \inputpage{proposal}{previous} \bodystyle \inputbody{proposal/content} \poststyle \inputpage{proposal}{post} }
渲染结果如下:
目录
文章中以“二、开题报告”为例,子标题都仍然存在且有编号。
比起利用加号的方式(例如`\chapter{}),保留了标题编号,且不需要手动\addtocontents`编辑目录。
),保留了标题编号,且不需要手动
发现有前辈增加过\changelocaltocdepth命令了,打扰了
可改进的内容
我们学院要求final版本的目录中,paper和proposal两部分的目录级别不同。 其中,paper部分的目录与现有的一致,但proposal的目录应该仅到下图所示的层级,也就是chapter等级。
代码与步骤
参考了Switching tocdepth in the middle of a document,在zjuthesis中应当修改的东西如下:
config/commands.tex,增加命令
zjuthesis.tex,修改
\newcommand{\inputundergraduate}
中\equal{\Period}{final}
,在proposal部分增加一行\changelocaltocdepth{0}
。完整如下:预期结果
渲染结果如下:
目录
文章中以“二、开题报告”为例,子标题都仍然存在且有编号。
比起利用加号的方式(例如`\chapter{}
),保留了标题编号,且不需要手动
\addtocontents`编辑目录。