从 LaTeX 中的 TOC 中删除特定小节

发布于 2024-09-25 00:53:07 字数 378 浏览 0 评论 0原文

可能的重复:
在 Latex 中隐藏 Toc 中的条目

Appendix
 A Section 1
     A.1 Subsection 1
     A.2 Subsection 2
 B Section 2

有没有办法摆脱第 n 小节,但该小节仍在文档中编号(即不使用 \subsection*)?

我考虑过限制 TOC 深度,但这似乎仅对于附录来说是不可能的?

Possible Duplicate:
hide an entry from Toc in latex

Appendix
 A Section 1
     A.1 Subsection 1
     A.2 Subsection 2
 B Section 2

Is there a way to get rid of Subsection n, but still have the subsection numbered in the document (i.e. not using \subsection*)?

I thought about limiting the TOC depth, but that does not seem to be possible for just the Appendix?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆流年 2024-10-02 00:53:10

这是一种(有点黑客但还不算太糟糕)的方法:

一切都结束了,您只需添加一个新命令 hiddensubsection ,由 给出

\newcommand{\hiddensubsection}[1]{
    \stepcounter{subsection}
    \subsection*{\arabic{chapter}.\arabic{section}.\arabic{subsection}\hspace{1em}{#1}}
}

然后您使用它而不是 创建您的 notoc subsection \subsection

\hiddensubsection{sectionname}

它的工作方式是手动递增小节计数器,然后创建一个未编号的小节,并将小节计数器作为标题的一部分。您可能需要调整数字和标题之间的间距,但我看不出有任何区别。

显然,如果需要,您可以对部分和子部分执行相同的操作

Here's one (sort of hackish but not too bad) way to work this:

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}}
}

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文