我想在我的论文中包含不同的枚举。对于第 1 部分,我想枚举以下内容:
但是,对于下面的代码:
\documentclass{report}
\usepackage{geometry}
\usepackage{enumitem}
\def\settozero{\setcounter{enumii}{-1}\renewcommand\theenumii{\arabic{enumii}}}
\newenvironment{myenumerate} {\begin{enumerate}\ifx\c@enumii\undefined\relax\else\settozero\fi} {\end{enumerate}}
\begin{document}
\section{Section 1}
\begin{enumerate}
\item
\begin{myenumerate}
\item I do not feel sad.
\item I feel sad
\item I am sad all the time and I can't snap out of it.
\item I am so sad and unhappy that I can't stand it.
\end{myenumerate}
\end{enumerate}
\section{Section 2}
\begin{enumerate}[label=(\alph*)]
\item blah blah :\begin{enumerate}[label=(\roman*)]
\item blah blah
\item blah blah\end{enumerate}
\item blah blah
\end{enumerate}
\结束{文档}
我明白了
我该如何修复这个问题?
答案1
非常简单enumitem
:您有start=
控制计数器初始值的密钥。此外,两个部分中的子枚举是对齐的:
\documentclass{report}
\usepackage{geometry}
\usepackage[shortlabels]{enumitem}
\begin{document}
\section{Section 1}
\begin{enumerate}[1.]
\item
\begin{enumerate}[(1), start = 0]
\item I do not feel sad.
\item I feel sad
\item I am sad all the time and I can't snap out of it.
\item I am so sad and unhappy that I can't stand it.
\end{enumerate}
\end{enumerate}
\section{Section 2}
\begin{enumerate}[(a)]
\item blah blah :
\begin{enumerate}[(i)]
\item blah blah
\item blah blah
\end{enumerate}
\item blah blah
\end{enumerate}
\end{document}
答案2
使用旧的枚举包,这相当容易(除非我遗漏了什么)。
\documentclass{report}
\usepackage{geometry}
\usepackage{enumerate}
\begin{document}
\section{Section 1}
\begin{enumerate}[1.]
\item
\begin{enumerate}[(1)] \setcounter{enumii}{-1}
\item I do not feel sad.
\item I feel sad
\item I am sad all the time and I can't snap out of it.
\item I am so sad and unhappy that I can't stand it.
\end{enumerate}
\end{enumerate}
\section{Section 2}
\begin{enumerate}[(a)]
\item blah blah :\begin{enumerate}[(i)]
\item blah blah
\item blah blah\end{enumerate}
\item blah blah
\end{enumerate}
\end{document}