5

I would like to obtain the following item/subitem behavior with enumitem:

\documentclass{article}
\begin{document}
\begin{enumerate}
   \item [(1)] first item;
   \item [(2)] second item;
   \begin{enumerate}
      \item [(2.1)] first subitem of the second item;
      \item [(2.2)] second subitem of the second item;
       \begin{enumerate}
          \item [(2.2.1)] first subitem of the second subitem of the second item;
       \end{enumerate}
   \end{enumerate}
      \item [(3)] third item.
\end{enumerate}
\end{document}

enter image description here

I know how to obtain this x.y.z label behavior without parentheses and locally (specifying [label*=\arabic*.] as an option in every enumerate environment). However, I don't know how to embrace the final label between parentheses, i.e, (x,y,z). How can achieve this with the enumitem package?

Also, It would be nice to be able to define the whole behavior in the outermost enumerate environment, (assuming by default the corresponding configuration in each of the nested enumerates). Is that possible?

3

If you want to use multiple environments like this throughout your document, you might want to consider defining your own enumerate-like environment. You can do so by using \newlist and \setlist from the enumitem package:

enter image description here

\documentclass{article}

\usepackage{enumitem}
\newlist{myenum}{enumerate}{3}
\setlist[myenum,1]{label*=(\arabic*)}
\setlist[myenum,2]{label=(\arabic{myenumi}.\arabic*)}
\setlist[myenum,3]{label=(\arabic{myenumi}.\arabic{myenumii}.\arabic*)}

\begin{document}
\begin{myenum}
   \item first item;
   \item second item;
   \begin{myenum}
      \item  first subitem of the second item;
      \item second subitem of the second item;
       \begin{myenum}
          \item  first subitem of the second subitem of the second item;
       \end{myenum}
   \end{myenum}
      \item  third item.
\end{myenum}
\end{document}
1
  • Thanks! is it possible to define an enumitem key (instead of a new environment) mimicking this behavior? Does this have any drawbacks compared with the new environment approach? – suitangi Mar 12 at 19:46
3
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=(\arabic*)]
   \item  first item;
   \item  second item;
   \begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
      \item  first subitem of the second item;
      \item  second subitem of the second item;
       \begin{enumerate}[label=(\arabic{enumi}.\arabic{enumii}.\arabic*)]
          \item  first subitem of the second subitem of the second item;
       \end{enumerate}
   \end{enumerate}
      \item  third item.
\end{enumerate}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.