Tag Archives: arabic

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.


Counters in LaTex

The following is a summary of counter usage and manipulations available in LaTex.

The following commands have a counter associated with it:

  • part
  • chapter
  • section
  • subsection
  • subsubsection
  • paragraph
  • subparagraph
  • page
  • equation
  • figure
  • table
  • footnote
  • mpfootnote
  • enumi
  • enumii
  • enumiii
  • enumiv

You have several possibilities to manipulate counters in LaTex:

  • \addtocounter {counter} {value} increments the specified counter by the value.
  • \newcounter {newcounter} [oldcounter] defines a new counter. Option ‘oldcounter’ is to link ‘newcounter’ to ‘oldcounter’.
  • \setcounter {counter} {value} sets the counter to have the specified value.
  • \usecounter{counter} used as the second argument of the list environment to number list items (see list command).
  • \value {counter} produces the value of the counter and is useful for doing arithmetic with counters.
  • \renewcommand {cmd} [args] [opt] {def} general command to define/redefine new commands.

Counter values can be printed in different formats such as:

  • \alph or \Alph {counter} for letters (a…z or A…Z) .
  • \arabic {counter} for arabic numbers (1…9).
  • \fnsymbol {counter} printing various symbols: asterisk, dagger, double dagger, section mark, paragraph mark, double vertical lines, double asterisk, double daggers, double double daggers. The value of counters must be between 1 and 9.
  • \roman or \Roman {counter} for roman numerals (I,II,III,IV,V,…,X,etc.)

Follow

Get every new post delivered to your Inbox.

Join 316 other followers