Set or remove vertical space of lists in LaTeX

In this tutorial, I will show you how to control the vertical spacing of a list in LaTeX. The vertical spacing of a list is controlled by these keys.

  • topsep
  • partopsep
  • parsep
  • itemsep

See the image below to see where these commands affect a list structure.
List structure.

Set vertical space between list items

To set vertical space between list items, you have to use the itemsep and parsep key. You can use them either globally or locally. But first of all, you have to load the enumitem package.

Set or remove vertical space between items globally

You can use the \setlist{<key>=<value>} command to set the vertical space between list items globally. Take a look.

\documentclass{article}
\usepackage{enumitem}
\setlist{itemsep=3pt, parsep=2pt}
\begin{document}

This is a List:
\begin{enumerate}
  \item first
  \item Second
  \item Third
\end{enumerate}

This is also a List:
\begin{itemize}
  \item first
  \item Second
  \item Third
\end{itemize}

\end{document}

Output:

Set vvertical space between items in list.
In order to remove the vertical space between list items, you have to set the key value to 0pt. Like this \setlist{itemsep=0pt, parsep=0pt}.

\documentclass{article}
\usepackage{enumitem}
\setlist{itemsep=0pt, parsep=0pt}
\begin{document}

This is a List:
\begin{enumerate}
  \item first
  \item Second
  \item Third
\end{enumerate}

This is also a List:
\begin{itemize}
  \item first
  \item Second
  \item Third
\end{itemize}

\end{document}

Output:
Set 0 vertical space between items globally.

Set vertical space between list items locally

In this case, you have to use the itemsep and parsep keys with the list environment in a square bracket, like [itemsep=<value>, parsep=<value>]. Take a look.

\documentclass{article}
\usepackage{enumitem}
\begin{document}

This is a List with some vertical space:
\begin{enumerate}[itemsep=3pt, parsep=2pt]
  \item first
  \item Second
  \item Third
\end{enumerate}

List with 0 vertical space between items:
\begin{itemize}[itemsep=0pt, parsep=0pt]
  \item first
  \item Second
  \item Third
\end{itemize}

\end{document}

Output:
Set vertical space between items locally.

Set or remove the vertical space around the list

You need to use the topsep key to set the vertical spacing of text above and below relative to the list. To set this key value globally you can use this \setlist{topsep=<value>} and for locally you can use this [topsep=<value>] with the list environment.

This text is too close to the list item:
\begin{enumerate}[itemsep=3pt, parsep=2pt, topsep=0pt]
  \item first
  \item Second
  \item Third
\end{enumerate}
This text is too close to the above list.

List with 0 vertical space between items:
\begin{itemize}[itemsep=0pt, parsep=0pt, topsep=3pt]
  \item first
  \item Second
  \item Third
\end{itemize}
The vertical space between this text and the list above is 3pt
\end{document}

Output:
set the vertical spacing of text above and below relative to the list.

Remove spaces between list items and text around the list at the same time

A simple command is enough to remove the vertical space between list items and the text around the list at the same time. You just use the \setlist{nosep} command in the preamble of the document. Also locally, you can use it [nosep] with the environment.

\documentclass{article}
\usepackage{enumitem}
\setlist{nosep}
\begin{document}

This text is too close to the list item:
\begin{enumerate}
  \item first
  \item Second
  \item Third
\end{enumerate}
This text is too close to the above list.

\end{document}

Output:

remove the vertical space between list items and the text around the list at the same time.
Or you can use this \setlist{noitemsep} to leave space around the whole list but remove space between list items. For locally, you can use this [noitemsep] with the environment.

\documentclass{article}
\usepackage{enumitem}
\setlist{noitemsep}
\begin{document}

This text is too close to the list item:
\begin{enumerate}
  \item first
  \item Second
  \item Third
\end{enumerate}
This text is too close to the above list.

\end{document}

Output:

leave space around the whole list but remove space between list items.

Leave a Reply

Your email address will not be published. Required fields are marked *