问题描述
可能重复:
在 Latex 中隐藏 Toc 的条目
Appendix
A Section 1
A.1 Subsection 1
A.2 Subsection 2
B Section 2
有没有办法摆脱第 n 小节,但仍然在文档中对小节进行编号(即不使用 subsection*)?
Is there a way to get rid of Subsection n, but still have the subsection numbered in the document (i.e. not using subsection*)?
我曾考虑过限制 TOC 深度,但这似乎只针对附录是不可能的?
I thought about limiting the TOC depth, but that does not seem to be possible for just the Appendix?
推荐答案
这是一种(有点老套但还不错)的方法:
Here's one (sort of hackish but not too bad) way to work this:
全部结束,您只需添加一个新命令 hiddensubsection
,由
All wrapped up, you just add a new command hiddensubsection
, given by
ewcommand{hiddensubsection}[1]{
stepcounter{subsection}
subsection*{arabic{chapter}.arabic{section}.arabic{subsection}hspace{1em}{#1}}
}
然后你使用这个而不是 subsection
创建你的 notoc 小节:
Then you create your notoc subsection using this instead of subsection
:
hiddensubsection{sectionname}
它的工作方式是手动增加小节计数器,然后创建一个未编号的小节,并将小节计数器作为标题的一部分.您可能需要调整数字和标题之间的间距,但我看不出有任何区别.
The way it works is by manually incrementing the subsection counter and then creating an unnumbered subsection with the subsection counter as part of the title. You may need to tweak the spacing between number and title, but i couldn't see any difference.
显然,如果需要,您可以对节和小节做同样的事情
Obviously you could do the same thing for sections and subsubsections if needed
这篇关于从 LaTeX 中的 TOC 中删除特定小节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!