You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何隐藏LaTeX目录章节编号并重置小节编号链?

解决LaTeX article类中断开章节编号链的问题

你的核心问题是小节编号延续了之前的章节计数,要让Introduction小节显示为1.1,只需重置章节计数器即可,具体修改如下:

修改后的代码

\documentclass{article}
\begin{document}
\tableofcontents

\newcommand{\fakesection}[1]{%
 \par\refstepcounter{section}% Increase section counter
  \sectionmark{#1}% Add section mark (header)
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}% Add section to ToC
  %Add more content here, if needed.
}

% 重置section计数器为0,确保后续section从1开始
\setcounter{section}{0}

\fakesection{Chapter 1: Introduction}
\begin{center}
\huge Chapter 1 \\
\huge Introduction
\end{center}

\subsection{Introduction}
Hello welcome.
\end{document}

原理说明

  • LaTeX的article类中,subsection的编号格式是\thesection.\arabic{subsection},完全依赖于section计数器的当前值。
  • 你之前的section计数器已累计到7,执行\refstepcounter{section}后变成8,因此小节编号显示为8.1。
  • 通过\setcounter{section}{0}将计数器清零,再执行\refstepcounter{section}让section变为1,对应的小节自然会从1.1开始计数,相当于断开了和之前章节的编号关联。

如果之后需要再次断开编号链,只需在新章节前重复使用\setcounter{section}{0}即可。

内容的提问来源于stack exchange,提问作者Mzi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 21:07:12