3

How may I have a enumeration using the enumerate environment from which the inner environment counter relates to the item number which is already there for a previous environment? Using an [already answered post](Nested enumeration numbering), when I enter the following:

\begin{enumerate}[1),‎label*=\arabic*‎‏), noitemsep]
\item % item number is 1)
Hello
\item % item number is 2)
How are you?
\begin{enumerate}[1), ‎label*=\arabic*‎‏), noitemsep]
\item % item number is 2.1)
I'm fine, thank you!
\item % item number is 2.2)
What about you?
\end{enumerate}
\item % item number is 3)
Good!
\item % item number is 4)
Do you know where is he?
\begin{enumerate}[1., ‎label*=\arabic*‎‏. noitemsep]
\item % item number is 4.1.
No!
\item % item number is 4.2.
Sorry
\end{enumerate}
\end{enumerate}

But I don't get the desired output. What I want is to get something like the figure below, if I enter something like the following:

enter image description here

Qaher
  • 1,242
  • Do you want 4.1. or 4.1)? – Bernard May 06 '16 at 19:33
  • I want something changeable, indeed when I type something like ‎label*=\arabic*‎‏. changes the sub-enumerate environment to ‍‍‍‍‍‍4.i. form. But at first, I need to know how I can make something like 2.i) numbering format. – Qaher May 06 '16 at 19:50

2 Answers2

3

Without using any extra packages, just redefine \theenumii, \labelenumi and \labelenumii:

 \documentclass{article}

  \renewcommand{\theenumii}{\theenumi.\arabic{enumii}}
  \renewcommand{\labelenumi}{\theenumi)}
  \renewcommand{\labelenumii}{\theenumii)}
  \begin{document}

  \begin{enumerate}
    \item Firat item
    \item Second item
      \begin{enumerate}
        \item First subitem of second item
        \item Second subitem of second item
      \end{enumerate}
    \item Third item
    \item Fourth item
      \begin{enumerate}
        \item First subitem of fourth item
        \item Second subitem of fourth item
      \end{enumerate}
  \end{enumerate}

\end{document}
Dan
  • 6,899
2

The enumeration is strange here, therefore I use a new list named strangenumerate

Since label*= cannot be applied here for the deeper nested levels (it prints a ), there are some other strategies:

  • Make a conditional on the level of nesting and change the label according to this
  • Refer directly to the counter of the current level, i.e. strangenumeratei here.

\documentclass{article}



\usepackage{enumitem}

\newlist{strangenumerate}{enumerate}{2}

\setlist[strangenumerate]{noitemsep}
\setlist[strangenumerate,1]{label={\arabic*)}}
\setlist[strangenumerate,2]{label={\arabic{strangenumeratei}.\arabic*)}}
\begin{document}

\begin{strangenumerate}
\item % item number is 1)
Hello
\item % item number is 2)
How are you?
\begin{strangenumerate}
\item % item number is 2.1)
I'm fine, thank you!
\item % item number is 2.2)
What about you?
\end{strangenumerate}
\item % item number is 3)
Good!
\item % item number is 4)
Do you know where is he?
\begin{strangenumerate}[label={\arabic{strangenumeratei}.\arabic*.}]
\item % item number is 4.1.
No!
\item % item number is 4.2.
Sorry
\end{strangenumerate}
\end{strangenumerate}
\end{document}

enter image description here