Tx · LaTeX & TikZ

How to Fix List Margins with enumitem

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify the margin

    Check whether the page margin, the list text, or the label is in the wrong position.

  2. 2. Set the list indent

    Use enumitem's leftmargin option to position the item text within its surrounding text.

  3. 3. Fit the label

    Use leftmargin=* to let enumitem calculate space for the widest label.

  4. 4. Check nested lists

    Set options for the relevant list level, then compile again and inspect the result.

A margin problem with enumitem usually means that an enumerate list’s text or labels are not aligned where you expect. The key distinction is between the document’s page margins and the indentation inside a list: enumitem controls list layout, not the width of the page’s text block.

For most list-indentation problems, set leftmargin. If the label width varies, use leftmargin=* to let enumitem calculate the list margin using its label-width settings. For labels wider than the default estimate, specify widest=... as needed.

Start with a minimal example

Load enumitem and set the list option directly:

\documentclass{article}
\usepackage{enumitem}

\begin{document}
Text before the list.

\begin{enumerate}[leftmargin=2em]
  \item First item.
  \item Second item with enough text to wrap onto another line.
\end{enumerate}

Text after the list.
\end{document}

Here, leftmargin=2em sets the horizontal indentation for the list. Increase it to move the item text farther right; decrease it to move the item text left. The em unit scales with the current font size. You can instead use a fixed length, such as leftmargin=25mm.

Align labels and item text

A list has more than one horizontal measurement. The most useful enumitem options are:

OptionWhat it controls
leftmarginThe list’s left indentation and the position of its item text
labelsepThe gap between the label and the item text
labelwidthThe width reserved for the label
labelindentThe horizontal indentation of the label
itemindentAn additional indentation for the first line of an item

When the label is wider than the space reserved for it, it may stick into the left margin or make the layout look uneven. With custom labels or multi-digit numbers, leftmargin=* is often a good first fix, but specify widest=... if the widest label is larger than the default estimate:

\begin{enumerate}[label=(\arabic*), leftmargin=*, widest=10]
  \item A short item.
  \item A longer item whose text wraps to a second line.
  \setcounter{enumi}{9}
  \item This item has a two-digit label.
\end{enumerate}

The * tells enumitem to calculate a suitable left margin using its label-width settings. The widest option lets you provide the label to use for that calculation; here, widest=10 accounts for the label (10). If you need a particular visual gap, combine it with an explicit labelsep, for example [label=(\arabic*), leftmargin=*, widest=10, labelsep=0.6em].

Apply settings to every list

If the same indentation should be used throughout the document, set it once with \setlist:

\setlist[enumerate]{leftmargin=2em}

To set a different indent for a particular nesting level, specify the level:

\setlist[enumerate,2]{leftmargin=3em}

A local option on one list overrides the general setting for that list. For example, \begin{enumerate}[leftmargin=*] can be used when most lists use a fixed indent but one has unusual labels.

If you mean the page margins

Changing leftmargin will not move the surrounding paragraphs or alter the page’s text block. For document-wide margins, use a page-layout package such as geometry:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{enumitem}

\begin{document}
Text and lists share the page's one-inch margins.
\end{document}

If the paragraph before and after a list is also too far from the paper edge, adjust the page layout rather than the list options.

Common mistakes

  • Changing labelsep to move the whole list. It changes only the gap between label and item text. Use leftmargin to adjust the list indentation.
  • Setting a fixed margin for labels of different widths. A fixed labelwidth can be too small when numbering reaches two or more digits. Try leftmargin=*, specifying widest=... if needed, or choose a label width large enough for the widest label.
  • Confusing leftmargin with the page margin. The former affects a list; the latter affects the document’s text block.
  • Setting a global option and expecting it to affect every list type. \setlist[enumerate]{...} applies to enumerate lists. Set options separately for itemize or other list environments if needed.
  • Using a large itemindent to fix alignment. This changes the first line of each item, not the list’s overall position. Wrapped lines may then appear misaligned.

When diagnosing a stubborn layout, reduce the document to a short example and change one option at a time. First decide whether the label, the item text, or the page text block is misplaced; then adjust the option that controls that part.

References

  1. enumitem package documentation
  2. geometry package documentation

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