Skip to content
ImagineWorld

Creating Lists

node_idnode-book_latex-beginner-s-guide_chapter-04-creating-lists
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num4
chapter_titleCreating Lists
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

In the previous chapters, we focused on formatting, both at the text level and across entire pages. Now, we turn to structuring content more precisely. Over the following two chapters, we’ll discuss how to organize information using lists and tables. We’ll begin with lists.

Lists are an effective, reader-friendly way to present information. You can highlight key points in a format that’s easy to scan and understand. The three most common list types are the following:

  • Bulleted lists: Used to emphasize distinct points that stand out from the main text
  • Numbered lists: Ideal for presenting points in a specific order
  • Definition lists: Used to explain terms or concepts in a structured manner

In this chapter, you’ll learn how to create each of these list types. We’ll cover the following:

  • Building lists
  • Customizing lists

We’ll start by creating basic lists and then move on to customizing their appearance and structure.

We’ll begin with unordered lists using bullet points to organize items. Next, we’ll deal with ordered lists that use numbers or letters to indicate a sequence. Finally, we’ll look at definition lists to present keywords alongside their corresponding explanations.

Let’s start with the most basic type of list: a bulleted list. It contains just the items without numbers, where each item is marked with a bullet symbol. That’s a much clearer way to present key points than squeezing them into a lengthy sentence within text in a paragraph.

As an example, we’ll create a list of layout-related LaTeX packages introduced in the previous chapter. Follow these steps:

  1. Create a new document with some introductory text:
    \documentclass{article}
    \begin{document}
    \section*{Useful packages}
    LaTeX provides several packages for designing the layout:
  2. Now add the list, using an itemize environment and \item commands:
    \begin{itemize}
    \item geometry
    \item typearea
    \item fancyhdr
    \item scrpage-scrlayer
    \item setspace
    \end{itemize}
  3. That was easy. Now we can end the document:
    \end{document}
  4. Click Typeset and have a look at the output:

Figure 4.1 – A bulleted list

Figure 4.1 – A bulleted list

We started with a section heading followed by some introductory text. To create the list itself, we used an environment called itemize. As you’ve already learned about environments in Chapter 2, Formatting Text and Creating Macros, \begin{itemize} starts it and \end{itemize} ends it. The \item command tells LaTeX to add a new item to the list. The \item works only within a list environment. Each item can include text of any length and even span multiple paragraphs. Well, that’s pretty easy.

When a list grows longer, we could improve clarity by dividing it. We can create lists under a list. It’s advisable to use different bullet points to distinguish between the list levels easily. LaTeX does this for us automatically.

To illustrate this with our example, let’s enhance our package list by grouping related items into topic categories. Here’s how:

  1. Modify the itemize environment of our example in the following way: create an itemize list for each topic and include it within an \item. The updated code looks like this:
    \begin{itemize}
    \item Page layout
    \begin{itemize}
    \item geometry
    \item typearea
    \end{itemize}
    \item Headers and footers
    \begin{itemize}
    \item fancyhdr
    \item scrpage-scrlayer
    \end{itemize}
    \item Line spacing
    \begin{itemize}
    \item setspace
    \end{itemize}
    \end{itemize}

Note that we carefully closed each environment.

  1. Compile the document to see the new list:

Figure 4.2 – A bulleted list with two levels

Figure 4.2 – A bulleted list with two levels

Here, we placed lists within an \item point inside a list, creating a nested list. LaTeX supports up to four levels of nesting. If we exceeded this limit, LaTeX would raise an error:

! LaTeX Error: Too deeply nested.

The following are defaults:

  • First-level items use bullet points
  • Second-level items use wide dashes
  • Third-level items are marked with an asterisk symbol (*)
  • Fourth-level items use centered dots

Deeply nested lists are rarely used; such complicated structures might be difficult to follow. If your list becomes too complex, consider restructuring or dividing it.

In our example’s source code, we indented each line inside the itemize environment. When there’s another itemize environment within a surrounding itemize environment, the \item lines are even more indented. This makes it easy to identify the nesting level at a glance. While LaTeX doesn’t require indentation, proper indentation within environments helps maintain the code, as it significantly improves its readability and structure. You can quickly see where environments begin and end. Indenting source code lines within an environment is a very good habit in general. You can also indent code lines to indicate that they belong to some parent line, like with an \item point that spans multiple lines, which we will see in the next section.

Using spaces or tabs to indent source code enhances the readability of the code. That has no impact on the output, since LaTeX treats multiple whitespace characters in a code line like a single space.

In the next section, we’ll see how to list key points in a specific sequence and number them.

Bulleted lists work well when the order of the items doesn’t matter. However, if the order is essential, we could organize the items by giving them numbers and creating a sorted list. This way, you guide the reader to follow the logical progression easily.

Let’s prepare a short step-by-step tutorial for setting up the page layout using a numbered list. Follow these steps:

  1. Open a new document and enter the following code:
    \documentclass{article}
    \begin{document}
    \begin{enumerate}
    \item State the paper size by an option to the
    document class
    \item Determine the margin dimensions using one
    of these packages:
    \begin{itemize}
    \item geometry
    \item typearea
    \end{itemize}
    \item Customize header and footer by one
    of these packages:
    \begin{itemize}
    \item fancyhdr
    \item scrpage-scrlayer
    \end{itemize}
    \item Adjust the line spacing for the whole document
    \begin{itemize}
    \item by using the setspace package
    \item or by the command
    \verb|\linespread{factor}|
    \end{itemize}
    \end{enumerate}
    \end{document}
  2. Click on Typeset to compile to generate these instructions:

Figure 4.3 – A numbered list with bulleted lists

Figure 4.3 – A numbered list with bulleted lists

We used an enumerate environment in a very similar way to the itemize environment, with each list entry beginning with the \item command. The main difference is that each \item line in our enumerate environment is automatically numbered instead of just having a bullet point in front. Again, we nested two lists, this time demonstrating that we can do so even when the lists are of different types. Mixed nesting can extend beyond four levels, but four is the maximum for each type of list, and a total of six levels is allowed for mixed lists.

The default numbering style for the enumerate environment is as follows:

  • First level: 1., 2., 3., 4., …
  • Second level: (a), (b), (c), (d), …
  • Third level: i., ii., iii., iv., …
  • Fourth level: A., B., C., D., …

The \item command can also take an optional argument. If you write \item[text], LaTeX will print text instead of the default number or a bullet. This way, you could use any numbering and any symbol to replace the bullet.

Now that we’ve covered bulleted and numbered lists, let’s look at a list type that we can use to typeset descriptions of multiple items.

We’ll now proceed to the third type of list, namely, definition lists, also known as description lists. In this format, each list item begins with a term or phrase, followed by its corresponding explanation.

To illustrate this, we’ll revisit our familiar theme of LaTeX packages. This time, instead of just listing the packages, we’ll provide a brief description of each one. Let’s pick a few from https://ctan.org/topic/list, which is a collection of list-related packages. This will also serve us in the next section, Customizing lists, where we’ll work with the same packages to demonstrate customization features.

Let’s begin by writing a brief summary of what each package can do. Follow these steps:

  1. We will use a description environment. Create a document with the following code:
    \documentclass{article}
    \begin{document}
    \begin{description}
    \item[paralist] provides compact lists and list
    versions that can be used within paragraphs,
    helps to customize labels and layout.
    \item[enumitem] gives control over labels
    and lengths in all kind of lists.
    \item[mdwlist] is useful to customize description
    lists, it even allows multi-line labels.
    It features compact lists and the capability
    to suspend and resume.
    \item[desclist] offers more flexibility in
    definition list.
    \item[multenum] produces vertical enumeration in
    multiple columns.
    \end{description}
    \end{document}
  2. Compile the document to get the definition list:

Figure 4.4 – A definition list

Figure 4.4 – A definition list

We used the description environment in much the same way as the other list environments, except that we used the optional argument of \item in square brackets. In the description environment, LaTeX automatically renders this argument in bold.

Compared to a bulleted list, the bullet symbols are replaced with bold keywords or terms.

We can also adjust the spacing of our lists, select bullet symbols, and modify the numbering style. Let’s look at this in the next section.

By default, LaTeX lists come with sensible settings for spacing, indentation, and symbols. However, in some cases, you may want to adjust the enumeration style, change the bullet symbols, or fine-tune the line spacing and indentation. Some packages help with space-saving and customizing the list’s appearance. Let’s begin by looking at the spacing.

A common question when writing with LaTeX is how to make lists take up less space. By default, LaTeX leaves generous spacing in and around lists, which can feel excessive. We’ll now see how to reduce that.

Let’s reduce the spacing in our list from Figure 4.3. We’ll eliminate the extra space between the list items and around the entire list. Follow these steps:

  1. In our numbered list example that produced Figure 4.3, include the paralist package and replace enumerate with compactenum, and itemize with compactitem:
    \documentclass{article}
    \usepackage{paralist}
    \begin{document}
    \begin{compactenum}
    \item State the paper size by an option to
    the document class
    \item Determine the margin dimensions using one
    of these packages:
    \begin{compactitem}
    \item geometry
    \item typearea
    \end{compactitem}
    \item Customize header and footer by one
    of these packages:
    \begin{compactitem}
    \item fancyhdr
    \item scrpage-scrlayer
    \end{compactitem}
    \item Adjust the line spacing for the whole document
    \begin{compactitem}
    \item by using the setspace package
    \item or by the command \verb|\linespread{factor}|
    \end{compactitem}
    \end{compactenum}
    \end{document}
  2. Compile and compare the spacing:

Figure 4.5 – A compact list

Figure 4.5 – A compact list

  1. Now extend the highlighted list item for setspace as follows:
    \item by using the setspace package and one
    of its options:
    \begin{inparaenum}
    \item singlespacing
    \item onehalfspacing
    \item double spacing
    \end{inparaenum}
  2. Compile and look at the change in the line spacing subject:

Figure 4.6 – A list within a paragraph

Figure 4.6 – A list within a paragraph

The paralist package provides several alternative list environments designed to be typeset within paragraphs or in a very compact look. We loaded this package and replaced the standard environments with their compact counterparts, enumerate with compactenum, and itemize with compactitem. While the syntax is basically the same, the new environments don’t produce additional vertical whitespace before and after a list. They also don’t add vertical space around list items, resulting in a tighter layout. Lists and items are used with the same line spacing as regular text. Finally, it looks much more compact and saves space. In step 3, we used the new inparaenum environment, where the items are numbered but stay inline within the same paragraph.

For each standard list type, the paralist package offers three corresponding compact alternative environments.

For bulleted lists, it introduces the following environments:

  • compactitem: A space-saving alternative to the itemize environment that removes vertical space before and after the list, and between its items
  • inparaitem: A bulleted list formatted inline within a paragraph, rarely seen in print
  • asparaitem: Each list item is formatted like a separate common LaTeX paragraph but starts with a bullet

For numbered lists, it provides the following list types:

  • compactenum: A compact version of the enumerate environment, without extra vertical space before or after the list or between its items
  • inparaenum: An enumerated list that appears inline within a paragraph
  • asparaenum: Each list item is laid out like a regular LaTeX paragraph, but is numbered

For description lists, it adds the following types:

  • compactdesc: A compact version of the description environment, eliminating the additional vertical space before and after the list and between its items
  • inparadesc: A description list fits into a paragraph
  • asparadesc: Each list item is formatted like a regular LaTeX paragraph, starting with the bold keyword or term, as in a description list

Now that we’ve adjusted the spacing, let’s look at how to modify the bullet symbols and numbering styles.

To meet language conventions or specific formatting guidelines, you might want to number list items using Roman numerals or letters, enclose them in parentheses, or follow them with dots. Some users also prefer using dashes instead of the default bullet points. The enumitem package offers flexible features to achieve all of this.

Let’s work on this and change the numbering style. We will apply alphabetical numbering with circled letters. Furthermore, we’ll change the default bullet symbol to a dash. To accomplish this, follow these steps:

  1. We’ll now use the enumitem package instead of paralist. We will use proper indentation within environments and return to the standard list syntax. However, to keep the layout compact, we’ll add the nosep option to lists:
    \documentclass{article}
    \usepackage{enumitem}
    \setlist{nosep}
    \setitemize[1]{label=---}
    \setenumerate[1]{label=\textcircled{\scriptsize\Alph*},
    font=\sffamily}
    \begin{document}
    \begin{enumerate}
    \item State the paper size by an option to the
    document class
    \item Determine the margin dimensions using one of
    these packages:
    \begin{itemize}
    \item geometry
    \item typearea
    \end{itemize}
    \item Customize header and footer by one of these
    packages:
    \begin{itemize}
    \item fancyhdr
    \item scrpage-scrheader
    \end{itemize}
    \item Adjust the line spacing for the whole document
    \begin{itemize}
    \item by using the setspace package
    \item or by the command \verb|\linespread{factor}|
    \end{itemize}
    \end{enumerate}
    \end{document}
  2. Compile and check the output:

Figure 4.7 – A customized enumerated list

Figure 4.7 – A customized enumerated list

We used commands from the enumitem package to customize list behavior. Let’s take a closer look:

  • \setlist{nosep}: The \setlist command applies properties valid for all types of lists. Here, we specified the nosep option to achieve very compact lists similar to the compact paralist environment. That setting removes all extra vertical spacing.
  • \setitemize[1]{label=–--}: The \setitemize command customizes bulleted lists. Here, we chose an em dash (---) as the label to get a wide leading dash.
  • \setenumerate[1]{label=\textcircled{\scriptsize \Alph*},font=\sffamily}: The \setenumerate command customizes numbered lists. We used it to set a label and a font for the label. The \Alph* command means enumeration in capital letters.

We can also apply these options locally in square brackets. Other examples are as follows:

  • \begin{itemize}[noitemsep] generates a compact bulleted list without any additional space between items and paragraphs
  • \begin{enumerate}[label=\Roman*.,start=3] makes the list numbered by III., IV., and so on
  • \begin{enumerate}[label=\alph*)],nolistsep] produces a very compact list numbered a), b), c), and so on

These are useful labeling commands for customizing numbered lists:

  • \arabic*: 1, 2, 3, 4, …
  • \alph*: a, b, c, d, …
  • \Alph*: A, B, C, D, …
  • \roman*: i, ii, iii, iv, …
  • \Roman*: I, II, III, IV, …

The asterisk * represents the current value of the list counter. You can freely add parentheses, punctuation, or other decorations. Later in this book, you’ll see how to select from thousands of symbols for labels and bullets.

For convenience, there’s also a short syntax: if you load the enumitem package with the shortlabels option, you may use a compact syntax such as \begin{enumerate}[(i)], \begin{enumerate}[(1)] where 1, a, A, i, and I correspond to \arabic*, \alph*, \Alph*, \roman*, and \Roman*, respectively. This allows for quick customization. However, consider using global commands to maintain consistent formatting throughout the document.

In this example, the \verb|code| command typesets code verbatim, “as it is” without interpreting it as LaTeX code. Instead of |, we can choose any character as the delimiter. Note that \verb cannot be used in arguments of commands such as \section and \footnote, nor in table headings. For longer blocks of such literal text, use the verbatim environment.

Let’s move on to another helpful feature of the package.

The enumitem package we used earlier also lets you continue list numbering. Let’s build on the previous example to see how that works:

  1. Just above the highlighted code line (\item Adjust the line spacing...), insert these lines to end the enumerate environment and continue with some regular text:
    \end{enumerate}
    \noindent\textbf{Tweaking the line spacing:}
  2. Next, restart the enumerate environment with this line:
    \begin{enumerate}[resume]
  3. Leave the rest of the code, including the other items, unchanged. Compile the document to see the result:

Figure 4.8 – A list that’s resumed

Figure 4.8 – A list that’s resumed

In step 1, we temporarily ended the list and continued with regular text. In step 2, we restarted the list by using the resume option, which tells enumitem to continue the previous list with the next number. The starred version, resume*, would also use the options from the previous list, if given.

LaTeX provides sensible default layouts for lists; however, there may be occasions when you may want to modify this layout, such as adjusting the margins or the indentation of items. All layout dimensions are determined by LaTeX macros, so-called lengths.

There’s a package that’s great for visualizing layouts, which presents these length macros. It’s called layouts. Let’s use it to examine the dimensions of LaTeX’s lists. We will use this short document:

\documentclass[12pt]{article}
\usepackage{layouts}
\begin{document}
\listdiagram
\end{document}

By simply compiling it, we will get the following diagram:

Figure 4.9 – The layout of lists

Figure 4.9 – The layout of lists

Isn’t it impressive? The layouts package can do even more, which you can read about in its documentation at https://texdoc.org/pkg/layouts or by running texdoc layouts at the command line.

Use the LaTeX \setlength command to customize those lengths – for example, \setlength{\labelwidth}{2cm}. Applying them to individual lists and certain nesting depths is hard. If you need to modify the list layout, the enumitem package is helpful again. We can use its commands, such as \setlist and its key=value interface, to adjust the lengths, as shown in the previous diagram.

For example, if we would like to remove the space between list items in the description environment and to reduce the left margin, we could load the enumitem package and write the following:

\setdescription{itemsep=0cm,parsep=0cm,leftmargin=0.5cm}

Note, we don’t use the backslash for keys. Similarly, \setitemize, \setenumerate, and \setlist can be used for fine-tuning. Try assigning values by yourself and test the effect on our examples. If you would like to learn more, have a look at the enumitem documentation at https://texdoc.org/pkg/enumitem or by running texdoc enumitem at the command prompt.

In this chapter, we explored lists as a means of organizing our content. Specifically, we covered how to create bulleted lists, numbered lists, and definition lists. Furthermore, we worked with compact and customized versions of such lists, including adjustments for spacing, as well as interrupting and resuming.

Such lists can help clarify and present your ideas more effectively. Next, we’ll turn our attention to tables to typeset structured data in rows and columns.