2

I have a list like this one:

List

I do not want to have spacing between lines (2) and (a), but I would like to keep spacing between (1) and (2) and between (b) and (3) (as on the photo). I tried to solve it by using LaTeX enumitem command \begin{enumerate}[topsep=-5pt] as shown below. I am interested in a similar command that can be used without giving the actual number for space height (-5pt), something like nosep (this one does not work) or so.

\documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[label={(}\arabic*{)}] \item Random text \item Random text \begin{enumerate}[nolistsep,topsep=-5pt] \item Random text \item Random text \end{enumerate} \item Random text \end{enumerate} \end{document} 
1
  • \itemsep is the additional vertical space between items. Commented Oct 21, 2021 at 14:10

1 Answer 1

1

What you probably want to do, is to set parsep to zero. Unlike itemsep, which is the distance between two adjacent entries, parsep is the distance between an entry and a following paragraph. A nested list behaves actually the same.

\documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[label={(}\arabic*{)}, parsep=0pt] \item Random text \item Random text \begin{enumerate}[nolistsep] \item Random text \item Random text \end{enumerate} \item Random text \end{enumerate} \end{document} 

enter image description here

Since a parsep is also added between adjacent items (see page 3 of the current documentation for the enumitem package), you probably want to keep it when there is no nested list. You can do this by first adding the value of \parsep to \itemsep and then (the order is important) set parsep to zero.

\documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[label={(}\arabic*{)}, itemsep={\dimexpr\itemsep+\parsep\relax}, parsep=0pt] \item Random text \item Random text \begin{enumerate}[nolistsep] \item Random text \item Random text \end{enumerate} \item Random text \end{enumerate} \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.