texblog

Increase enumerate & itemize depth with enumitem

The default maximum depth for the list environments enumerate and itemize is four. Using more than four nested levels will lead to the error: “Too deeply nested”.

One way to increase the depth of a list is using a mix of enumerate and itemize. However, obviously, some levels will be a bulleted rather than enumerated.

The enumitem package allows you to define new lists with an arbitrary number of levels. For example, let’s create nested lists with up to five levels.
Define a new list longenum of type enumerate which has 5 levels. Set the label style for each level they way you like. I used roman, alph and arabic.

\usepackage{enumitem}
\newlist{longenum}{enumerate}{5}
\setlist[longenum,1]{label=\roman*)}
\setlist[longenum,2]{label=\alph*)}
\setlist[longenum,3]{label=\arabic*)}
\setlist[longenum,4]{label=(\roman*)}
\setlist[longenum,5]{label=(\alph*)}

That’s all you need to know. The rest is straight forward, just use longenum instead of enumerate for each level and create a nested lists with up to 5 levels.

Here is the complete sample code with the output below:

\documentclass[11pt]{article}
\usepackage{enumitem}
\newlist{longenum}{enumerate}{5}
\setlist[longenum,1]{label=\roman*)}
\setlist[longenum,2]{label=\alph*)}
\setlist[longenum,3]{label=\arabic*)}
\setlist[longenum,4]{label=(\roman*)}
\setlist[longenum,5]{label=(\alph*)}
\begin{document}
\section*{Enumerated list with 5 levels}
\begin{longenum}
	\item Level 1 first
	\item Level 1 second
	\begin{longenum}
		\item Level 2 first
		\item Level 2 second
		\begin{longenum}
			\item Level 3 first
			\item Level 3 second
			\begin{longenum}
				\item Level 4 first
				\item Level 4 second
				\begin{longenum}
					\item Level 5 first
					\item Level 5 second
				\end{longenum}
			\end{longenum}
		\end{longenum}
	\end{longenum}
\end{longenum}
\end{document}

Enumitem package documentation.

Exit mobile version