# LaTeX/List Structures

LaTeX

Getting Started

Common Elements

Mechanics

Technical Texts

Special Pages

Special Documents

Creating Graphics

Programming

Miscellaneous

Help and Recommendations

Appendices

edit this boxedit the TOC

Convenient and predictable list formatting is one of the many advantages of using LaTeX. Users of WYSIWYG word processors can sometimes be frustrated by the software's attempts to determine when they intend lists to begin and end. As a mark-up language, LaTeX gives more control over the structure and content of lists.

## List StructuresEdit

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.

### ItemizeEdit

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}

### EnumerateEdit

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}

### DescriptionEdit

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}

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[1].

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

## Nested listsEdit

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}

## Customizing listsEdit

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 spacingEdit

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 packagesEdit

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 manuallyEdit

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 redefine the enumerate environment:

 \let\oldenumerate\enumerate\renewcommand{\enumerate}{   \oldenumerate   \setlength{\itemsep}{1pt}   \setlength{\parskip}{0pt}   \setlength{\parsep}{0pt}}

Another approach is to redefine the \item command globally.

### Customizing enumerated listsEdit

#### Using packagesEdit

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[2], or the more sophisticated package enumitem by Javier Bezos[3]. 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. [4]

Sometimes you may want to place some short text in front of the enumeration for example: "Exercise 1, Exercise 2, Execise 3, ...". This is possible with the enumitem package:

 \begin{enumerate}[label=\bfseries Exercise \arabic*:]   \item 5 + 7 = 12   \item 9 + 1 = 10   \item 2 * 2 = 4\end{enumerate} Enumeration with text

\bfseries makes it bold, Exercise is the text and \arabic* inserts the counter followed by a colon (:) which is treated as text again.

#### ManuallyEdit

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:


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:


### Customizing itemised listsEdit

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}

## Inline listsEdit

Inline lists can be achieved as follows.

### With package paralistEdit

The paralist package provides the inparaenum environment (with an optional formatting specification in square brackets):

 \usepackage{paralist}% ...\begin{document} 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. ...

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) ...

### With package enumitemEdit

 \usepackage[inline]{enumitem}% ...\begin{document} Inline lists, which are sequential in nature, just like enumerated lists, but are\begin{enumerate*}[label=\itshape\alph*\upshape)]\item formatted within their paragraph;\item usually labelled with letters; and\item usually have the final item prefixed with and' or or',\end{enumerate*} like this example. ...

Package shortlst also provides inline lists.

## Easylist packageEdit

The easylist package [5] 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
• 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:


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.

## Notes and ReferencesEdit

1. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=noline
2. [1]The enumerate package, David Carlisle 1999
3. [2]The enumitem package, Javier Bezos 2011
4. CTAN documentation for enumerate
5. easylist documentation

 Previous: Fonts Index Next: Special Characters