LaTeX 自定义编号:使用 \newcounter 和 \setcounter
要自定义编号,可以使用'\newcounter' 和 '\setcounter' 命令。下面是一个例子:
\documentclass{article}
\\newcounter{mycounter}
\\setcounter{mycounter}{1}
\begin{document}
\section*{Section \arabic{mycounter}}
This is the first section.
\\stepcounter{mycounter}
\section*{Section \arabic{mycounter}}
This is the second section.
\\stepcounter{mycounter}
\section*{Section \arabic{mycounter}}
This is the third section.
\end{document}
在这个例子中,我们定义了一个名为'mycounter' 的新计数器,并将其初始值设置为 1。然后,我们在每个章节标题中使用 '\arabic{mycounter}' 来显示计数器的当前值。在每个章节结束时,我们使用 '\stepcounter{mycounter}' 命令将计数器的值增加 1。
原文地址: https://www.cveoy.top/t/topic/lCxJ 著作权归作者所有。请勿转载和采集!