LaTeX/List Structures

List Structures

Lists often appear in documents, especially academic, as their purpose is often to present information in a clear and concise fashion. List structures in LaTeX are simply environments which essentially come in three flavors: itemize, enumerate and description.

All lists follow the basic format:

\begin{list_type}

  \item The first item
  \item The second item
  \item The third etc \ldots

\end{list_type
}

All three of these types of lists can have multiple paragraphs per item: just type the additional paragraphs in the normal way, with a blank line between each. So long as they are still contained within the enclosing environment, they will automatically be indented to follow underneath their item.

Itemize

This environment is for your standard bulleted list of items.

\begin{itemize}
  \item The first item
  \item The second item
  \item The third etc \ldots
\end{itemize
}

Itemize.svg

Enumerate

The enumerate environment is for ordered lists, where by default, each item is numbered sequentially.

\begin{enumerate}
  \item The first item
  \item The second item
  \item The third etc \ldots
\end{enumerate
}

Enum.svg

Description

The description environment is slightly different. You can specify the item label by passing it as an optional argument (although optional, it would look odd if you didn't include it!). Ideal for a series of definitions, such as a glossary.

\begin{description}
  \item[First] The first item
  \item[Second] The second item
  \item[Third] The third etc \ldots
\end{description
}

Desc.svg

Sometimes you want a description where the text begins on a new line. This cannot easily be done with \\. The trick is to use \hfill.

\begin{description}
  \item[First] \hfill \\
  The first item
  \item[Second] \hfill \\
  The second item
  \item[Third] \hfill \\
  The third etc \ldots
\end{description
}

LaTeX desc-newline.svg

↑Jump back a section

Nested lists

LaTeX will happily allow you to insert a list environment into an existing one (up to a depth of four -- if you need more than four, use the easylist package). Simply begin the appropriate environment at the desired point within the current list. Latex will sort out the layout and any numbering for you.

\begin{enumerate}
  \item The first item
  \begin{enumerate}
    \item Nested item 1
    \item Nested item 2
  \end{enumerate}
  \item The second item
  \item The third etc \ldots
\end{enumerate
}

Nested.svg

↑Jump back a section

Customizing lists

Customizing LaTeX is outside the beginners' domain. While not necessarily difficult in itself, because beginners are already overwhelmed with the array of commands and environments, moving on to more advanced topics runs the risk of confusion.

However, since the tutorial aims at being complete, we shall still include a brief guide on customizing lists. Feel free to skip!

Note that in the following when \renewcommand is used it must appear after the \begin{document} instruction so the changes made are taken into account. This is needed for both enumerated and itemized lists.

Also beware of the spaces in the label definitions. It is a common error!

Line spacing

As you may have noticed, in standard LaTeX document classes, the vertical spacing between items, and above and below the lists as a whole, is more than between paragraphs: it may look odd if the descriptions are too short.

Using packages

If you want tightly-packed lists, use the mdwlist package (included in the mdwtools bundle), which provides compact, "starred" versions of the previous environments, i.e. itemize*, enumerate* and description*. They work exactly in the same way, but the output is more compact. Other packages providing compacted lists are paralist and enumitem.

Alternatively, use the memoir class and with \tightlists.

Customizing manually

Inside lists you can redefine some length/dimension variables of LaTeX, for example using:

\begin{itemize} \itemsep1pt \parskip0pt \parsep0pt
  \item first item
  \item second item
\end{itemize
}

Alternatively, to create a unified look in your document you can define your own enumerate environment:

\newenvironment{my_enumerate}{
  \begin{enumerate}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{
  \end{enumerate}
}

Another approach is to redefine the \item command globally.

\newlength{\wideitemsep}
\setlength{\wideitemsep}{.5\itemsep}
\addtolength{\wideitemsep}{-7pt}
\let\olditem\item
\renewcommand{\item}{\setlength{\itemsep}{\wideitemsep}\olditem
}

Customizing enumerated lists

Using packages

The thing people want to change most often with Enumerated lists are the counters. A quick solution to this problem is provided by the enumerate package of David Carlisle[1], or the more sophisticated package enumitem by Javier Bezos[2]. When using enumerate, it is possible to specify the style of the numbering: \begin{enumerate}[style].

The options A, a, I, i and 1 define the style and are self-explanatory, anything else is treated as text. To use any of the style tokens as text they can be enclosed in braces, e.g. {A} will give a literal A. [3]

Manually

To go any further and do it yourself instead, a brief introduction to LaTeX counters is required. You should check the dedicated chapter as we will not delve into the details for now.

There are four individual counters that are associated with itemized lists, each one represents the four possible levels of nesting, which are called:

enumi
enumii
enumiii
enumiv

The counter is incremented by \item before it is printed. For example to reset enumi use:

\begin{enumerate}
  \setcounter{enumi}{4}
  \item fifth element
\end{enumerate
}

5. fifth element

The command responsible for formatting the various levels of nesting are

\labelenumi
\labelenumii
\labelenumiii
\labelenumiv

Example:

\renewcommand{\labelenumi}{(\Roman{enumi})}
\renewcommand{\labelenumii}{\Roman{enumi}.~\alph{enumii}
}

This simply redefines the appearance of the label, which is fine, providing that you do not intend to cross-reference to a specific item within the list, in which case the reference will be printed in the original format. This issue does not arise if you redefine the counter printer:

\renewcommand{\theenumi}{\Roman{enumi}}
\renewcommand{\labelenumi}{(\theenumi)}
\renewcommand{\theenumii}{\alph{enumii}}
\renewcommand{\labelenumii}{\theenumi.~\theenumii
}

Customizing itemised lists

Itemized lists are not as complex as they do not need to count. Therefore, to customize, you simply change the labels. It can be done manually for each entry with \item[new symbol], eg \item[$\star$].

The itemize labels are accessed via \labelitemi, \labelitemii, \labelitemiii, \labelitemiv, for the four respective levels.

\renewcommand{\labelitemi}{\textgreater}

The above example would set the labels for the first level to a greater than (>) symbol. Of course, the text symbols available in Latex are not very exciting. Why not use one of the ZapfDingbat symbols, as described in the Symbols section. Or use a mathematical symbol:

\renewcommand{\labelitemi}{$\star$}

Itemized list with tightly set items, that is with no vertical space between two consecutive items, can be created as follows.

\begin{itemize}
  \setlength{\itemsep}{0cm
}%
  \setlength{\parskip}{0cm}%
  \item Item opening the list
  \item Item tightly following
\end{itemize}

↑Jump back a section

Inline lists

Inline lists are a special case as they require the use of the paralist package which provides the inparaenum environment (with an optional formatting specification in square brackets):

\usepackage{paralist}
% ...

\begin{document}

\textbf{\itshape Inline lists}, which are
sequential in nature, just like enumerated
lists, but are
\begin{inparaenum}[\itshape a\upshape)]
\item formatted within their paragraph;
\item usually labelled with letters; and
\item usually have the final item prefixed with
`and' or `or',
\end{inparaenum
} like this example.
...

Latex example paralist.svg

To change the styles of the counter, tokens A, a, I, i, and 1 can be used in the optional argument to produce the counter with one of the styles \Alph, \alph, \Roman, \roman and \arabic. For example: \begin{inparaenum}[(i)] produces the labels (i), (ii), (iii) ...

Other packages providing inline lists are shortlst and enumitem.

↑Jump back a section

Easylist package

The easylist package allows you to create list using a more convenient syntax and with infinite nested levels. It is also very customizable.

Load the package with the control character as optional argument:

\usepackage[ampersand]{easylist}

The easylist environment will default to enumerations.

\begin{easylist}
& Main item~:
&& Sub item.
&& Another sub item.
\end{easylist
}

It features predefined styles which you can set as optional argument.

\begin{easylist}[itemize]
% ...
\end{easylist}

Available styles:

  • tractatus
  • checklist - All items have empty check boxes next to them
  • booktoc - Approximately the format used by the table of contents of the book class
  • articletoc - Approximately the format used by the table of contents of the article class
  • enumerate - The default
  • itemize

You can customize lists with the \ListProperties(...) command and revert back the customization with \newlist{}. Yes, that's parentheses for \ListProperties parameters.

The Style parameter sets the style of counters and text, the Style* parameter sets the sytle of counters, and the Style** parameter sets the style of text. The parameter Numbers determines the way that the numbers are displayed and the possible values are r or R (for lower and upper case Roman numerals), l or L (for lower and upper case letters), a (for Arabic numbers, the default), and z (for Zapf's Dingbats).

The FinalMark parameter sets the punctuation of the final counter (Ex: FinalMark3={)}) while FinalSpace sets the amount of space between the item and the item's text. The Margin parameter sets the distance from the left margin (Ex: FinalSpace2=1cm). The Progressive parameter sets the distance from the left margin of all items in proportion to their level.

The {{{1}}} parameter prevents the first n counters from appearing in all levels. If there is a number after a parameter (Ex: Style3*) then this numbers indicates the level that it will affect (Ex: Style3=\color{red}).

Example of custom enumerate:

\begin{easylist}[enumerate]
\ListProperties(Style2*=,Numbers=a,Numbers1=R,FinalMark={)})
& Main item~:
&& Sub item.
&& Another sub item.
\end{easylist
}

Note that we put the FinalMark argument between {} to avoid LaTeX understanding it as the end of the properties list. Now we change the default properties to print a custom itemize:

\usepackage{amssymb}
\ListProperties(Hide=100, Hang=true, Progressive=3ex, Style*=-- ,
Style2*=$\bullet$ ,Style3*=$\circ$ ,Style4*=\tiny$\blacksquare$ )
% ...

\begin{easylist}
& Blah
& Blah
&& Blah
&&& Blah
&&&& Blah
&&&&& Blah
\end{easylist
}

– Blah
  \bullet Blah
   \circ Blah
    \blacksquare Blah
     – Blah

Spaces in Style parameters are important. The Style* parameter acts as a default value and easylist will use a medium dash for level 1, 5 and onward.

You can also define custom styles using LaTeX macros:

\newcommand\myitemize{\ListProperties(Hide=100, Hang=true, Progressive=3ex, Style*=$\star$ )}
\newcommand\myenumerate{\ListProperties(Space=2\baselineskip)
}

% ...
\begin{easylist} \myitemize
& Blah
\end{easylist
}

Important note: easylist has some drawbacks. First if you need to put an easylist inside an environment using the same control character as the one specified for easylist, you may get an error. To circumvent it, use the following commands provided by easylist:

\Activate
\begin{easylist}
& ...
\end{easylist
}
\Deactivate

Besides using easylist along with figures may cause some trouble to the layout and the indentation. LaTeX lists do not have this problem.

Currently easylist does not work with Beamer.


↑Jump back a section

Notes and References

  1. [1]The enumerate package, David Carlisle 1999
  2. [2]The enumitem package, Javier Bezos 2011
  3. CTAN documentation for enumerate


Previous: Fonts Index Next: Special Characters
↑Jump back a section
Last modified on 15 May 2013, at 09:44