Examples of how to use the Enumitem Package in the LaTeX Typesetting System

Examples of how to use the Enumitem Package in the LaTeX Typesetting System

LaTeX is a freely available system for high-quality typesetting, particularly for mathematical and scientific writing. There are many packages available that make typesetting certain formats easier. One of these is the enumitem package that simplifies the formatting of itemized lists, description lists, and enumerated lists.

I have put together a simple one-page set of examples of using enumitem showing how to get different spacing and formatting. A .pdf file shows the results. The LaTeX source that generates that file is as follows:

\documentclass[10pt]{article}
\usepackage[hmargin=8mm, vmargin=10mm, noheadfoot]{geometry}
\usepackage[document]{ragged2e}
\usepackage[pdfauthor={Truman Collins},
    pdftitle={List Examples with the Enumitem Package},
    bookmarks=false]{hyperref}
\usepackage{multicol}
\usepackage{stmaryrd}
\usepackage{enumitem}
\usepackage{printlen}
\usepackage[compact]{titlesec}

\parsep=0.2in
\parskip=0.1in
\partopsep=0mm
\raggedcolumns
\pagestyle{empty}

\uselengthunit{mm}

% Try for better line evenness than LaTeX does, but not as much
% hyphenation as the default, which is {0pt plus 2em}.

\setlength{\RaggedRightRightskip}{0pt plus 3em}


% Description environment where the item described is typeset in
% italics.

\newenvironment{descriptionItalicA}
{
  \begin{description}[font=\itshape,labelindent=3mm,leftmargin=*,topsep=0mm]
}
{
  \end{description}
}

% Description environment with the description on the next line.

\newenvironment{descriptionB}
{
  \begin{description}[style=nextline,leftmargin=17mm,topsep=0mm,noitemsep]
}
{
  \end{description}
}

% Useful description list that indents based on the length of a
% parameter, presumably the longest label.

\newenvironment{VarDescription}[1]%
  {\begin{list}{}{\renewcommand{\makelabel}[1]{\textbf{##1:}\hfil}%
    \settowidth{\labelwidth}{\textbf{#1:}}%
    \setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}}}%
  {\end{list}}

\begin{document}

\begin{center}
{\large\textbf{Enumerations, Itemizations, and Descriptions in \LaTeX\
 using the Enumitem Package}}\\
Truman Collins \hspace{5mm} \today
\end{center}

\small
\justifying
\parindent=0mm
\LaTeX\ by itself supports enumerated, itemized, and description
lists, but with some formatting limitations.  Variations are possible
through parameterization of standard lists, defining new ones, or
using packages that allow more flexibility.  This short set of
examples uses the package \emph{enumitem} to show a number of
possibilities.  Note that a new named environment can be created for
each style of list --- see the first two non-standard description
examples.

In each list, any non-zero lengths are shown.  These lengths include:
labelwidth, labelindent, labelsep, leftmargin, itemindent, and topsep.

\RaggedRight
\begin{multicols}{3}

\subsubsection*{Descriptions}

Here is a standard description environment:

\begin{description}

  \item[topsep] is \rndprintlength{\topsep}

  \item[leftmargin] is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item[labelindent] is \rndprintlength{\labelindent}

  \item[labelsep] is \rndprintlength{\labelsep}

  \item[labelwidth] is \rndprintlength{\labelwidth}

  \item[itemindent] is \rndprintlength{\itemindent}

\end{description}

This description list uses the \emph{enumitem} package to make
italisized labels that are indented.  The following options are used:
\texttt{[font=$\backslash$itshape, labelindent=3mm, leftmargin=*,
topsep=0mm]}.

\begin{descriptionItalicA}

  \item[leftmargin] is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item[labelindent] is \rndprintlength{\labelindent}

  \item[labelsep] is \rndprintlength{\labelsep}

  \item[labelwidth] is \rndprintlength{\labelwidth}

  \item[itemindent] is \rndprintlength{\itemindent}

\end{descriptionItalicA}

Here the style is set so that if the label word would stick into the
description text, the text will be put on the next line.  Also, space
is removed between items.  The following options are used:
\texttt{[style=nextline, leftmargin=17mm, topsep=0mm, noitemsep]}.

\begin{descriptionB}

  \item[leftmargin] is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item[labelindent] is \rndprintlength{\labelindent}

  \item[labelsep] is \rndprintlength{\labelsep}

  \item[labelwidth] is \rndprintlength{\labelwidth}

  \item[itemindent] is \rndprintlength{\itemindent}

\end{descriptionB}

Here, the start of the item text is adjusted so that all of the labels
fit.  Note that this uses a defined list separate from
\emph{enumitem}, and the widest item has to be included as a separate
argument:

\begin{VarDescription}{12:00}

  \item[10:00] Read about igneous rocks.

  \item[12:00] Find a metamorphic rock.

  \item[1:00] Throw a sedementary rock.

\end{VarDescription}

\columnbreak

\subsubsection*{Enumerations}

Here is the standard enumeration.  Labels are aligned right with no
indention, although space is allowed for large label numbers:

\begin{enumerate}

  \item topsep is \rndprintlength{\topsep}

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{enumerate}

Here is an enumeration with explicitly set lengths.  Options:
\texttt{[noitemsep, topsep=0mm, labelindent=3mm, leftmargin=*,
widest=3., align=right]}.

\begin{enumerate}[noitemsep,topsep=0mm,labelindent=3mm,leftmargin=*,widest=3.,align=right]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

  \item itemindent is \rndprintlength{\itemindent}

\end{enumerate}

Here is an enumeration with italicised lower case letters.  Options:
\texttt{[topsep=0mm, label=$\backslash$emph\{$\backslash$alph*\})]}.

\begin{enumerate}[topsep=0in,label=\emph{\alph*})]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{enumerate}

Here is an enumeration indented 15mm.  Note that the labels are
aligned to the right.  Options: \texttt{[topsep=0mm,
leftmargin=15mm]}:

\begin{enumerate}[topsep=0mm, leftmargin=15mm]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{enumerate}

Here is an enumeration with no topsep and flushed to the left.
Options: \texttt{[topsep=0mm, leftmargin=*]}:

\begin{enumerate}[topsep=0mm,leftmargin=*]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

  \item itemindent is \rndprintlength{\itemindent}

\end{enumerate}

\columnbreak

\subsubsection*{Itemizations}

Here is the standard itemization list:

\begin{itemize}

  \item topsep is \rndprintlength{\topsep}

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

  \item itemindent is \rndprintlength{\itemindent}

\end{itemize}

Here is an itemization list with topsep set to 0 and a
different label.  Options: \texttt{[topsep=0mm,
label=$\backslash$textrm\{--\}]}:

\begin{itemize}[topsep=0mm, label=\textrm{--}]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{itemize}

Here is an itemization list with the labels, which are long dashes,
flushed to the left.  Options: \texttt{[topsep=0mm,
label=$\backslash$textrm\{-\,-\,-\}, leftmargin=*]}:

\begin{itemize}[topsep=0mm, label=\textrm{---}, leftmargin=*]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{itemize}

Here is the standard itemization list indented by 15mm.  Options:
\texttt{[topsep=0mm, label=$\backslash$textrm\{-\,-\,-\},
leftmargin=15mm]}:

\begin{itemize}[topsep=0mm, label=\textrm{---}, leftmargin=15mm]

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

\end{itemize}

Here is an itemization list with empty box labels.  Note that you need
to include package \emph{stmaryrd} to get the boxes.  Options:
\texttt{[topsep=0mm, label=\$$\backslash$boxempty\$]}:

\begin{itemize}[topsep=0mm, label=$\boxempty$]

  \item topsep is \rndprintlength{\topsep}

  \item leftmargin is \rndprintlength{\leftmargin}, which is the
    distance to the text for the item.

  \item labelindent is \rndprintlength{\labelindent}

  \item labelsep is \rndprintlength{\labelsep}

  \item labelwidth is \rndprintlength{\labelwidth}

  \item itemindent is \rndprintlength{\itemindent}

\end{itemize}

\newpage

\end{multicols}

\end{document}

Back to my homepage.

Copyright 2008 by Truman Collins
For comments, email: Truman Collins (truman@tkcs-collins.com)
Most recent update: March 28, 2008
59,182 visits (4 today, 13 this week, 76 this since March 28, 2008.
http://www.tkcs-collins.com/truman/latex/list_examp.shtml