Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to have a list like

(1) foo
   (1.1) foo
   (1.2) foo
(2) foo

I am using the package enumitem and

\begin{enumerate}[label=(\arabic*)]
   \item foo
\end{enumerate}

I know that i can append the parent label with label*=, but that leads to (1).1.

Has anybody an idea?

share|improve this question
    
duplicate: nested-enumeration-numbering –  cmhughes Oct 24 '12 at 19:29
3  
@cmhughes I don't think so -- the parenthesis problem is special. –  lockstep Oct 24 '12 at 19:48
    
@lockstep though making the parenthesis the only difference............hmmmm so –  azetina Oct 24 '12 at 20:01
    
@azetina Check the answers of the supposed "original" -- for the present question, you can use neither \theenumi nor \label*. –  lockstep Oct 24 '12 at 20:03
    
@lockstep You are right....i take it back –  azetina Oct 24 '12 at 20:19
add comment

2 Answers

up vote 9 down vote accepted

This is how it can be done using enumitem:

enter image description here

\documentclass{article}
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\begin{document}
\begin{enumerate}[label=(\arabic*)]
  \item foo
  \begin{enumerate}[label=(\arabic{enumi}.\arabic*)]
    \item foo
    \item foo
  \end{enumerate}
  \item foo
\end{enumerate}
\end{document}​

You need to define the nested labels without the labelling format of the parent. The counters for the levels of enumerate are enumi, enumii, enumiii, while \arabic* refers to the current level counter.

share|improve this answer
add comment

You can get this automatically, that is, forgetting to add [...] to each environment, with

\documentclass{article}
\usepackage{enumitem}

\newlist{jana}{enumerate}{3}
\setlist[jana,1]{label=(\arabic*)}
\setlist[jana,2]{label=(\arabic{janai}.\arabic*)}
\setlist[jana,3]{label=(\arabic{janai}.\arabic{janaii}.\arabic*)}

\begin{document}
\begin{jana}
\item A
\item A
  \begin{jana}
  \item B
  \item B
    \begin{jana}
    \item C
    \item C
    \end{jana}
  \end{jana}
\end{jana}
\end{document}

Choose a more sensible environment name, of course, changing also the occurrence of the string; for instance, if you choose myenum, you will say \arabic{myenumi}, \arabic{myenumii} and so on.

This provides up to three levels, add more levels with the same pattern if needed.

enter image description here

One can also change the format of the labels: for instance

\newlist{labelist}{enumerate}{5}
\setlist[labelist,1]{label=(\Alph*)}
\setlist[labelist,2]{label=(\Alph{labelisti}.\arabic*)}
\setlist[labelist,3]{label=(\Alph{labelisti}.\arabic{labelistii}.\arabic*)}
\setlist[labelist,4]{label=(\Alph{labelisti}.\arabic{labelistii}.\arabic{labelistiii}.\arabic*)}
\setlist[labelist,5]{label=(\Alph{labelisti}.\arabic{labelistii}.\arabic{labelistiii}.\arabic{labelistiv}.\arabic*)}

will define formats

(A)
  (A.1)
    (A.1.1)
      (A.1.1.1)
        (A.1.1.1.1)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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