我想对我的部分进行如下编号
A section
Another section
A third section
1 - A subsection
1.1 - A subsubsection
1.2 - Another subsubsection
如您所见,章节未编号,但子章节和子子章节有编号。有没有一种简单的方法可以实现此目的而无需诉诸titlesec
?谢谢。
答案1
\documentclass{article}
\makeatletter
% we use \prefix@<level> only if it is defined
\renewcommand{\@seccntformat}[1]{%
\ifcsname prefix@#1\endcsname
\csname prefix@#1\endcsname
\else
\csname the#1\endcsname\quad
\fi}
% define \prefix@section
\newcommand\prefix@section{Section \thesection: }
\makeatother
\begin{document}
\section{Hello}
\subsection{Subsection 1}
\subsection{Subsection 2}
\subsubsection{Subsubsection 1}
\section{Go on}
\subsection{Subsection 3}
\subsubsection{Subsubsection 1}
\end{document}