How to Set Vertical Spacing for Nested Itemize Lists
At a glance
- 1. Load enumitem
Add \usepackage{enumitem} to your document preamble.
- 2. Choose a nesting level
Use \setlist[itemize,1] for the outer list and \setlist[itemize,2] for the next level.
- 3. Set spacing lengths
Adjust topsep, itemsep, parsep, and partopsep to control different kinds of vertical space.
- 4. Override locally if needed
Pass spacing options in square brackets on a particular itemize environment.
The enumitem package lets you set vertical spacing for each nesting level of an itemize list. The main distinction is between space around the whole list and space between parts of the list: these are controlled by different length options.
Set spacing by nesting level
Load enumitem in the preamble, then use \setlist[itemize,<level>]{...}. Level 1 is the outermost itemize, level 2 is nested inside it, and so on.
\documentclass{article}
\usepackage{enumitem}
\setlist[itemize,1]{
topsep=8pt,
itemsep=4pt,
parsep=2pt,
partopsep=0pt
}
\setlist[itemize,2]{
topsep=3pt,
itemsep=1pt,
parsep=0pt,
partopsep=0pt
}
\begin{document}
Text before the list.
\begin{itemize}
\item First outer item.
\item Second outer item, with a nested list:
\begin{itemize}
\item First inner item.
\item Second inner item.
\end{itemize}
\item Third outer item.
\end{itemize}
Text after the list.
\end{document}
This example gives the outer list more space than the inner list. Change the values to suit your document; the units can be points (pt), millimetres (mm), or other TeX units.
You can also set common values for every itemize level with \setlist[itemize]{...}, then override a particular level with a more specific setting. For instance:
\setlist[itemize]{itemsep=3pt, topsep=6pt}
\setlist[itemize,2]{itemsep=1pt, topsep=2pt}
The second command changes the settings for level 2 while the general settings apply to the other levels. If you want the same settings for every list type, \setlist{...} can be used instead, but that also affects lists such as enumerate.
What the spacing options control
| Option | Controls |
|---|---|
topsep | Space above and below the list |
itemsep | Space between successive items |
parsep | Space between paragraphs within a single item |
partopsep | Extra space around a list when it begins after a paragraph break |
These settings apply independently at each level. For example, changing itemsep at level 2 does not change the gap between items at level 1.
A list’s visible spacing can also be affected by the document’s paragraph spacing, such as \parskip. In particular, partopsep is added in the situation where the list starts after a paragraph break; setting it to zero removes that extra component, not every possible source of space around the list.
Change spacing for only one list
For a one-off adjustment, put options in the optional argument of that environment:
\begin{itemize}[topsep=2pt, itemsep=0pt]
\item A compact item.
\item Another compact item.
\end{itemize}
The local options override the corresponding settings for that list. This is useful when most lists should use the document-wide style but one list needs to be tighter or more open.
Common mistakes
- Changing only
itemsep: This affects gaps between items, not the space before and after the list. Adjusttopsepfor that. - Using the wrong level number: A nested list is level 2 only if it is directly inside a level-1 list. Deeper nesting increases the level number.
- Expecting
topsepto remove all surrounding whitespace: Paragraph spacing andpartopsepcan also contribute. Check those settings if a gap remains. - Setting every list globally by accident:
\setlist{...}affects list types beyonditemize. Use\setlist[itemize]{...}when you mean only bullet lists.
For predictable results, set the options you care about explicitly at each level, then use local options only for exceptions.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.