本文介绍了从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

\newcommand{\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中删除特定的小节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 09:38