Tx · LaTeX & TikZ

How to Change Numbering in a LaTeX Sublist

Published By the 9to5Science editorial team

At a glance

  1. 1. Load enumitem

    Add the enumitem package to your document preamble.

  2. 2. Set the nested label

    Give the inner enumerate environment a label format such as lowercase letters or Roman numerals.

  3. 3. Set reference format

    Use the ref option if cross-references should include the parent item number.

  4. 4. Check nesting levels

    Each nested enumerate environment has its own counter and normally restarts at its first label.

Nested enumerate lists use different label styles by default, but you can choose your own. The simplest approach is to load the enumitem package and set the label on the inner list. This also lets you control references to subitems independently of the labels printed in the list.

Set a label for the sublist

Add enumitem in the preamble, then give the nested enumerate its own label option. In the option, \alph* means lowercase letters, \roman* means lowercase Roman numerals, and \arabic* means ordinary numbers. The asterisk tells enumitem to use the current list counter.

For example, label=\alph*) prints a), b), and so on. To include parentheses, write label=(\alph*). You can combine the parent number with the subitem label for a hierarchical style such as 1.a.

A complete example

This document produces a numbered outer list and lettered sublists. The subitem reference is set to include its parent number.

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=\arabic*.]
  \item First main item
    \begin{enumerate}[label=\alph*), ref=\theenumi.\alph*]
      \item First subitem\label{item:first-sub}
      \item Second subitem
    \end{enumerate}
  \item Second main item
    \begin{enumerate}[label=(\roman*)]
      \item A subitem with Roman numbering
    \end{enumerate}
\end{enumerate}

Subitem reference: \ref{item:first-sub}.

\end{document}

The first inner list is printed as a), b). The ref=\theenumi.\alph* option makes \ref{item:first-sub} produce 1.a, rather than just a. The second inner list uses parenthesized Roman numerals. Compile twice if necessary for references to update.

Choose a style for each nesting level

You can set styles on individual lists, as in the example, or apply them to every list at a particular depth. The outermost enumerate is level 1; its child is level 2.

\setlist[enumerate,1]{label=\arabic*.}
\setlist[enumerate,2]{label=(\alph*)}
\setlist[enumerate,3]{label=\roman*.}

Put these commands after \usepackage{enumitem} in the preamble. They set the label style for all enumerate lists at those levels. A third-level list will use lowercase Roman numerals followed by a period. You can instead put options on a particular enumerate environment when only one list needs a special style.

LaTeX’s traditional defaults are usually Arabic numerals at the first level, lowercase letters in parentheses at the second, lowercase Roman numerals at the third, and uppercase letters at the fourth. Exact appearance can depend on the document class or other packages. Explicit enumitem settings make the intended labels clear.

Change labels without changing numbering

The label option controls what appears beside each item. It does not necessarily control what \ref prints. Set ref as well when you want a cross-reference format that differs from the default. For a hierarchical label printed beside each subitem, for example, use:

\begin{enumerate}[label=\arabic*.]
  \item Main item
    \begin{enumerate}[label=\theenumi.\alph*)]
      \item Subitem
    \end{enumerate}
\end{enumerate}

Here the subitem label itself includes the current outer number, giving 1.a). If you only want a) beside the item but want 1.a in references, set label=\alph*) and ref=\theenumi.\alph* instead.

Common mistakes

  • Using \alph without the star in an enumitem label. Use \alph* for the current item in the list. \alph{counter} is a different LaTeX command form and requires a counter name.
  • Changing label but expecting \ref to change too. Set ref when you need a particular cross-reference format.
  • Putting the options on the outer list. To change only the sublist, put the options on the inner \begin{enumerate} or configure level 2 with \setlist.
  • Expecting a new sublist to continue the previous one. A nested list normally begins again at its first label. If you intentionally need to continue a sequence across separate lists, enumitem provides resume options; ordinary nested lists do not need them.

References

  1. The enumitem package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.