如何手動設定分段編號

如何手動設定分段編號

有沒有辦法以 5.2 小節開始頁面:

5.2 Section
 5.2.5 Subsection
 5.2.6 Subsection

否則,我會得到 1 部分和 0.1 小節,這是我不需要的。有什麼包或某種技巧嗎?

答案1

有沒有辦法以 5.2 小節開始頁面?

怎麼樣

\clearpage % start a new page here
\setcounter{section}{5}
\setcounter{subsection}{1}
\subsection{Hello World} % increments 'subsection' counter automatically (to "2")

答案2

看來您想任意設定小節的編號,這是我的解決方案

\newcommand{\asubsection}[2]{
\setcounter{subsection}{#1}
\addtocounter{subsection}{-1}
\subsection{#2}
}

然後如下所示,根據需要為您的小節指定任何編號

\asubsection{3}{The Dirac Field}
\label{TDF}
...
\asection{12}{The Renormalization Group}
... Also read subsection \ref{TDF}.

輸出如下

任一分段編號

我們可以看到交叉引用\ref{TDF}和方程式編號正在使用正確的小節編號。

相關內容