我想从目录中删除章节编号。
\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.
}
\fakesection{Chapter 1: Introduction}
\begin{center}
\huge Chapter 1 \\
\huge Introduction
\end{center}
\subsection{Introduction}
Hello welcome.
\end{document}
我一开始尝试使用
*
隐藏该部分,但没有成功。
[编辑] 章节号隐藏问题是,但现在有一个更大的问题。我要如何将第 {introduction} 小节编号从 8.1 更改为 1.1?
有没有办法打破章节的链....类似于分页?
通过使用
\numberline{\thesection}
,您可以在目录中的“章节”条目中明确添加一个数字。如果您不想要它,请将其删除。
\documentclass{article}
\begin{document}
\tableofcontents
\newcommand{\fakesection}[1]{%
\par\refstepcounter{section}% Increase section counter
\sectionmark{#1}% Add section mark (header)
\addcontentsline{toc}{section}{#1}% Add section to ToC
%Add more content here, if needed.
}
\fakesection{Chapter 1: Introduction}
\begin{center}
\huge Chapter 1 \\
\huge Introduction
\end{center}
\subsection{Introduction}
Hello welcome.
\end{document}