How to Indent Nested Lists with Short Labels in enumitem
At a glance
- 1. Set each list level
Configure the first and nested list levels separately with enumitem’s level-specific settings.
- 2. Choose label widths
Use widest to reserve enough space for the longest label you expect at each level.
- 3. Let enumitem calculate
Set leftmargin=* so the label width and label separation determine the text indentation.
- 4. Check custom labels
If an item uses a longer one-off label, increase the reserved width or set a fixed margin.
The indentation of a list is controlled by the space reserved for its label and the gap between that label and the item text. Short labels such as 1. or (a) can make a list look cramped, while nested lists may need different indentation at each level.
The usual fix is to configure each level of the list with enumitem, provide a representative widest label value, and let the package calculate the left margin.
What controls the indentation?
The key settings are:
label: the label format, such as\arabic*.or(\alph*).labelwidth: the space reserved for the label.labelsep: the gap between the label and the item text.leftmargin: the distance from the surrounding text to the item text.widest: a sample value substituted for*whenenumitemcalculates space for labels.
With leftmargin=*, enumitem calculates a suitable margin using the label width and separation. The label itself can remain short; widest tells the package how much space to reserve. Set these options for each list level because a nested list has its own label format and indentation.
A working example
This complete example uses numbered first-level items and parenthesized lettered subitems. Both levels have their own label-width sample and automatic left margin.
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{
label=\arabic*.,
widest=99,
leftmargin=*,
labelsep=0.6em
}
\setlist[enumerate,2]{
label=(\alph*),
widest=m,
leftmargin=*,
labelsep=0.6em
}
\begin{document}
\begin{enumerate}
\item First item, with a nested list.
\begin{enumerate}
\item A short subitem label.
\item Another subitem; its text aligns with the first.
\end{enumerate}
\item Second item.
\end{enumerate}
\end{document}
The enumitem package provides the list settings, and \setlist[enumerate,1] and \setlist[enumerate,2] target the first and second levels. The first level reserves space as if its label were 99.; the second uses (m) as its sample. Adjust these samples to match the longest labels your document will use. labelsep=0.6em controls the visible gap, while leftmargin=* derives the overall text indentation from the label dimensions.
If your list may exceed 99 items, choose a wider sample, such as widest=999. The widest value is the content substituted for *; punctuation or parentheses in label are included automatically. You can also put the settings directly in a list, for example \begin{enumerate}[label=\arabic*.,leftmargin=*,widest=99].
When you need exact alignment
If the automatically calculated margin is not the layout you want, use explicit dimensions. For example, leftmargin=2.5em fixes the distance to the item text; choose a value large enough for the label and the desired gap. You can set different fixed values for different nesting levels:
\setlist[enumerate,1]{label=\arabic*.,leftmargin=2.5em}
\setlist[enumerate,2]{label=(\alph*),leftmargin=2em}
A fixed margin is useful when several lists must line up with other page elements. If you set leftmargin explicitly, check that the label has enough room: a long label can extend into the surrounding text if the margin is too small.
For a one-off item with a custom optional label, such as \item[Remark], widest may not account for that label. Either reserve enough space with a larger fixed margin or use a list style intended for descriptive labels. widest is best suited to labels produced by the list’s regular label format.
Common mistakes
- Setting only the first level: Nested lists have separate dimensions. Configure each level whose indentation needs to change.
- Using a sample that is too short: If the actual label is wider than
widest, its text may not align with other items. Use a wide enoughwidestvalue for the expected number of digits; punctuation inlabelis included automatically. - Confusing
labelsepwithleftmargin:labelsepchanges only the gap after the label. It does not by itself set the overall indentation of the item text. - Expecting
leftmargin=*to enforce a fixed page position: It computes a margin from the list’s label dimensions. Use a fixedleftmarginwhen you need a particular measurement.
Compile the example and adjust widest, labelsep, or the per-level margins to suit the longest labels and the surrounding layout.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.