作为终身教职组合包的一部分,我需要创建一个带有以下形式的编号列表
A.5.0 Section
A.5.50 Subsection
A.5.60 Subsection
A.5.70 Subsection
我怎样才能让enumerate
环境自动(即无需\setcounter
每次使用)以 10 为单位计数,或者通常以 n 为单位计数?
编辑:解决方案还应与子部分兼容。例如:
A.5.0 Section
A.5.50 Subsection
A.5.50.1 Subsubsection
A.5.50.2 Subsubsection
A.5.60 Subsection
A.5.70 Subsection
答案1
我修改了马修的回答略:
\documentclass{article}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}\addtocounter{enumiii}{9}}
\renewcommand{\labelenumiii}{\theenumiii}
\begin{document}
\begin{enumerate}
\item Top level
\begin{enumerate}
\setcounter{enumii}{4}
\item Section
\begin{enumerate}
\setcounter{enumiii}{49}
\item Subsection
\item Subsection
\item Subsection
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}
假设你想按 n 计数,那么你所要做的就是将命令更改\addtocounter
为
\addtocounter{enumiii}{n-1}
例如,反击 5:
\addtocounter{enumiii}{4}
更新
以下是满足您的要求的更新定义:
\newcounter{countby}
\setcounter{countby}{10}
\addtocounter{countby}{-1}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}
\addtocounter{enumiii}{\arabic{countby}}}
\renewcommand{\theenumiv}{
\addtocounter{enumiii}{-\arabic{countby}}
\theenumi.\arabic{enumii}.\arabic{enumiii}.\arabic{enumiv}
\addtocounter{enumiii}{\arabic{countby}}
}
\renewcommand{\labelenumiv}{\theenumiv}
这次,你只需要找到命令\setcounter{countby}{...}
并将其设置为你想要计数的数字。下面是一个例子,假设出于某种原因我们想要以 17 为单位计数:
\setcounter{countby}{17}
答案2
您可以自定义计数器的打印方式,在末尾添加一个零。
\documentclass{article}
\renewcommand{\theenumi}{\Alph{enumi}}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.0}
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumiii}{\theenumi.\arabic{enumii}.\arabic{enumiii}0}
\renewcommand{\labelenumiii}{\theenumiii}
\begin{document}
\begin{enumerate}
\item Top level
\begin{enumerate}
\setcounter{enumii}{4}
\item Section
\begin{enumerate}
\setcounter{enumiii}{4}
\item Subsection
\item Subsection
\item Subsection
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}