答案1
如果使用documentclass书,您可能考虑使用随该documentclass附带的\frontmatter
命令。\mainmatter
\backmatter
下面是一个使用文章类的示例,其中用于维护部分计数器的“基础设施”被维护两次,这使得可以在编号样式之间切换并且对每个编号样式进行持续编号。
\documentclass{article}
\usepackage{hyperref}
\makeatletter
\newcounter{administrativesection}
\renewcommand\theadministrativesection{\Roman{section}}
\let\theHadministrativesection\theadministrativesection
%
\newcommand\c@mainsection{}%
\let\c@mainsection=\c@section
%
\newcommand\themainsection{}%
\let\themainsection=\thesection
%
\newcommand\theHmainsection{}%
\let\theHmainsection=\theHsection
%
\newcommand\mainsectioning{%
\let\c@section=\c@mainsection
\let\thesection=\themainsection
\let\theHsection=\theHmainsection
}%
\newcommand\administrativesectioning{%
\let\c@section=\c@administrativesection
\let\thesection=\theadministrativesection
\let\theHsection=\theHadministrativesection
}%
\makeatother
\begin{document}
\tableofcontents
\administrativesectioning
\section{Section 1}
\section{Section 2}
\section{Section 3}
\mainsectioning
\section{Main Section 1}
\subsection{Main Subsection 1}
\subsection{Main Subsection 2}
\section{Main Section 2}
\administrativesectioning
\section{Section 4}
\end{document}
答案2
以下是使用 KOMA-Script 类的建议scrartcl
:
\documentclass[sfdefaults=false]{scrartcl}% needs version 3.39 or newer
\DeclareNewSectionCommand[
style=section,
level=\sectionnumdepth,
beforeskip=-3.5ex plus -1ex minus -.2ex,
afterskip=2.3ex plus .2ex,
indent=0pt,
font=\usekomafont{section},
tocstyle=section,
toclevel=\sectiontocdepth,
tocindent=0pt,
tocnumwidth=1.5em,
tocdynnumwidth,
tocentryformat=\usekomafont{sectionentry}
]{mysection}
\renewcommand\themysection{\Roman{mysection}}
\begin{document}
\tableofcontents
\clearpage
\mysection{Section 1}
\mysection{Section 2}
\mysection{Section 3}
\section{Main Section 1}
\subsection{Main Subsection 1}
\subsection{Main Subsection 2}
\mysection{Section 4}
\end{document}
结果