[Tex/LaTex] Ordered Nested lists similar to Microsoft WORD numbered nested lists

#enumerateenumitemlistsnesting

In LaTeX, by default the numbering styles change depending on the depth of the nested lists as shown below.

\begin{enumerate}
   \item First level item
   \item First level item
   \begin{enumerate}
     \item Second level item
     \item Second level item
     \begin{enumerate}
       \item Third level item
       \item Third level item
       \begin{enumerate}
         \item Fourth level item
         \item Fourth level item
       \end{enumerate}
     \end{enumerate}
   \end{enumerate}
 \end{enumerate}

Output of the above:

enter image description here

Question: In LaTeX, how can we achieve something similar to nested numbered lists in Microsoft WORD, as shown below?

enter image description here

Best Answer

You can do this easily with the enumitem package.

The enumitem package allows you to determine the numbering system for any level or all levels of a list class. In this example, I've used:

\setlist[enumerate,2]{label=\theenumi.\arabic*.,ref=\theenumi.\arabic*}

This means "set the label of the second level of enumerate to be the label of the first level (\theenumi) plus the arabic number representation of the current level (\arabic*)."

Since you likely don't want a dot after the number in references, I've added a separate specification for references that excludes it. If you want to do this for other levels, you can add a format for each sublevel:

\setlist[enumerate,2]{label=\theenumi.\arabic*.,ref=\theenumi.\arabic*}
\setlist[enumerate,3]{label=\theenumii.\arabic*.,ref=\theenumii.\arabic*}

The toplevel counter is enumi, the next level is enumii, etc. The output representation of those counters is \theenumi, \theenumii, etc. So each definition has to refer to the representation of the counter of the previous level in its definition.

\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,2]{label=\theenumi.\arabic*.,ref=\theenumi.\arabic*}
\begin{document}
\begin{enumerate}
   \item First level item
   \item First level item
   \begin{enumerate}
     \item Second level item
     \item Second level item
   \end{enumerate}
 \end{enumerate}

\end{document}  

output of code