我想使用(i)、(ii)等为引理创建编号,如下面的屏幕截图中黄色突出显示的那样。
然后,我创建的代码如下。
\documentclass[journal]{IEEEtran}
\newtheorem{lemma}{Lemma}
\begin{document}
\begin{lemma}\label{lemma:min_req_time}
The new sequence has following properties.
\renewcommand{\labelenumi}{\Roman{enumi}}
\begin{enumerate}
\item The minimum required time of the robot operation is $(n-1)w + nv$ in between the processing and cleaning states, including vice versa, of every step.
\item In addition, the minimum required time of the robot operation is $(n+1)w + (n+2)v$ after finishing the processing or cleaning for the first time and repeating the same cycle for the next cleaning or processing.
\end{enumerate}
\end{lemma}
\end{document}
背面的 Tex Live 2022 效果如下。
有人能建议需要修改代码以获得(i)、(ii)等编号样式吗?
谢谢。
答案1
我建议使用该enumitem
包,因为它提供了(在我看来)一种更清晰的重新定义标签的方法。此外,它允许以相同的格式打印参考资料。请看以下示例没有 enumitem
:
\documentclass[journal]{IEEEtran}
\begin{document}
\renewcommand{\labelenumi}{(\roman{enumi})}
\noindent The new sequence has following properties.
\begin{enumerate}
\item The minimum\ldots\label{item:one}
\item In addition\ldots\label{item:two}
\end{enumerate}
Here are references to \ref{item:one} and \ref{item:two}.
\end{document}
这产生了
如果使用上面的包,我们可以实现以下功能:
\documentclass[journal]{IEEEtran}
\usepackage{enumitem} % <- load enumitem
\begin{document}
%\renewcommand{\labelenumi}{(\roman{enumi})} % <- not needed anymore
\noindent The new sequence has following properties.
\begin{enumerate}[label=(\roman*)] % <- specify label format
\item The minimum\ldots\label{item:one}
\item In addition\ldots\label{item:two}
\end{enumerate}
Here are references to \ref{item:one} and \ref{item:two}. % <- produce matching references
\end{document}
如果您不希望引用看起来像标签,这也没问题,因为您可以指定ref
:使用例如,\begin{enumerate}[label=(\roman*),ref=[\alph*-]
您将获得像(i)
、这样的标签(ii)
,但像[a-
、这样的引用[b-
(不知道为什么要这样做,但这是可能的)。
\setlist[enumerate]{label=(\roman*)}
如果您加入序言,也可以全局进行这些更改。
答案2
我建议你改变
\renewcommand{\labelenumi}{\Roman{enumi}}
到
\renewcommand{\labelenumi}{(\roman{enumi})}
如果你只想更改一个环境的编号样式lemma
,请在之后立即执行该指令\begin{lemma}
。如果你想将更改应用于全部 enumerate
环境中,请务必执行文档序言中的指令。
\documentclass[journal]{IEEEtran}
\newtheorem{lemma}{Lemma}
\usepackage{newtxmath} % Times Roman math font (optional)
\begin{document}
\begin{lemma}\label{lemma:min_req_time}
\renewcommand{\labelenumi}{(\roman{enumi})}
The new sequence has following properties.
\begin{enumerate}
\item The minimum required time of the robot operation is $(n-1)w + nv$ in between the processing and cleaning states, including vice versa, of every step.
\item In addition, the minimum required time of the robot operation is $(n+1)w + (n+2)v$ after finishing the processing or cleaning for the first time and repeating the same cycle for the next cleaning or processing.
\item \dots\dots
\item \dots\dots
\item \dots\dots
\item \dots\dots
\item \dots\dots
\end{enumerate}
\end{lemma}
\end{document}