Loading web-font TeX/Main/Regular
Skip to main content

LaTeX: Itemize and Enumerate

Previously, we talk about paragraph, spacing, and indentation. What about listing in \mathrm{\LaTeX}?

Just like MS Word, \mathrm{\LaTeX} has both bullet and alphanumeric environment for listing. Bullet listing is constructed inside the itemize domain. For example,

\documentclass{article}
\begin{document}
\begin{itemize}
\item Continuous Distributions
\begin{itemize}
\item Uniform
\item Normal
\item Exponential
\item Gamma
\item Chi-Square
\item Beta
\end{itemize}
\item Discrete Distributions
\begin{itemize}
\item Binomial
\item Geometric
\item Hypergeometric
\item Poisson
\item Negative Binomial
\end{itemize}
\end{itemize}
\end{document}
view raw tex8.tex hosted with ❤ by GitHub
The codes above generate list with sublists. The outer list uses bullet for entries (Line 5 and Line 14) while the sublists (Line 7-12 and Line 16-20) use hyphen. The itemize domain can have up to three nested lists, each with a particular character for entries. Here is something worth to explore,

\documentclass{article}
\begin{document}
\begin{itemize}
\item One
\item Two
\begin{itemize}
\item Three
\item Four
\begin{itemize}
\item Five
\item Six
\begin{itemize}
\item Seven
\item Eight
\end{itemize}
\end{itemize}
\end{itemize}
\end{itemize}
\end{document}
view raw tex9.tex hosted with ❤ by GitHub
This returns Output 1, the first list with entries Line 5-6 uses bullets, then a sublist under Line 6 with two entries (Line 8-9) uses hyphen, another subsublist uses asterisk, and further down to subsubsublist, dot or period is utilize. If we go further to the fourth nested list we get error that says, "Too deeply nested".
Nested Itemize Error in Texmaker
For alphanumeric characters, the enumerate environment is used. Just like itemize, enumerate is limited to three nested lists. And has the following characters for four levels of listing: 1., (a), i., and A. Here is an example,

\documentclass{article}
\begin{document}
\begin{enumerate}
\item One
\item Two
\begin{enumerate}
\item Three
\item Four
\begin{enumerate}
\item Five
\item Six
\begin{enumerate}
\item Seven
\item Eight
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document}
view raw tex10.tex hosted with ❤ by GitHub
If you notice, there is not much difference between these codes and the previous one, we only replace the itemize with enumerate. With changes made, however, different outputs induced. Output 1 compiled from previous code for itemize and Output 2 from enumerate domain.
Output 1
Output 2

I hope you are not aware of the spacing in the codes above, the reason why we need to indent these, is for readability. It is always a good practice to indent the codes, usually four spaces. The final products as we witness, are indented. This is not of course the effect of the indentation in the codes, remember that \mathrm{\LaTeX} ignores white spaces.

enumerate has a  package that offers more functions for manipulating the domain. For example, the demo we have previously, starts with numeric characters for the first list and roman number for the second nested list. What about if we want our list not in numeric form but rather in roman, how is that? Or what about if we want it to have A-1, A-2, \cdots, or Boy-A, Boy-B, \cdots. Things like that can be done using the enumerate package. Try this,

\documentclass{article}
\usepackage{enumerate}
\begin{document}
\begin{enumerate}[i]
\item Binomial
\item Poisson
\item Geometric
\end{enumerate}
\begin{enumerate}[{A}-1]
\item Binomial
\item Poisson
\item Geometric
\end{enumerate}
\begin{enumerate}[{Boy}-A]
\item Binomial
\item Poisson
\item Geometric
\end{enumerate}
\end{document}
view raw tex11.tex hosted with ❤ by GitHub
Now we want to start the enumeration at 5 or 21 or any number not 1. How is that? Well, we use \setcounter{enumi}{starting_number-1}, enumi is short for enumerate. Here is an example that starts at v (five),

\begin{enumerate}[i]
\setcounter{enumi}{4}
\item Binomial
\item Poisson
\item Geometric
\end{enumerate}
view raw tex12.tex hosted with ❤ by GitHub
Another type of listing is the description environment (reference here). Try this

\documentclass{article}
\usepackage{enumerate}
\begin{document}
\begin{description}
\item[Normal] In probability theory, the normal (or Gaussian)
distribution is a very commonly occurring continuous probability
distribution—a function that tells the probability of a number
in some context falling between any two real numbers.
\item[Uniform] In probability theory and statistics, the continuous
uniform distribution or rectangular distribution is a family of
symmetric probability distributions such that for each member of
the family, all intervals of the same length on the distribution's
support are equally probable.
\item[Exponential] In probability theory and statistics, the
exponential distribution (a.k.a. negative exponential distribution)
is the probability distribution that describes the time between
events in a Poisson process, i.e. a process in which events occur
continuously and independently at a constant average rate.
\end{description}
\end{document}
view raw tex13.tex hosted with ❤ by GitHub
This gives us Output 3; the description of the three distributions are originally from Wikipedia.

Output 3
 More on \mathrm{\LaTeX} list structure is available here.