[Tex/LaTex] Vertical Spacing (with enumitem) with Various Levels of Itemize

enumitemitemizespacing

I am currently working around verstical space in lists and changig a bit the spacing. I have come up around this answer: Vertical space in lists

That has worked fine for me with enumitem package.

However I am trying to write a two (possibly three) level list. Something like this:

\documentclass[a4paper, 12pt]{report}
\usepackage[onehalfspacing]{setspace}
\usepackage{enumitem}
\renewcommand{\labelitemii}{$\diamond$}
...
\begin{itemize}[itemsep=5pt,parsep=0pt]
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}

With output:
<code>enter image description here</code>

As you can see, defining the separation of lines at the beginning of Level 1 changes the separation, but it doesn't change it for the Level 2. I want to avoid having to adding the suffix [itemsep=5pt,parsep=0pt] at every level, as my list has various items at different levels.

Important for me is that I don´t want to change it globally (!) for the whole document (!), as for other lists I still wish the standard values. That´s why something like \setlist{itemsep=5pt,parsep=0pt} at the beginning of the document is not helpful.

Question: Can Someone tell me how to use code like the one above which automatically changes the spacing for all levels? (Not just level 1)

I guess the solution lies in creating a personal enviornment like \newenvironment{myitemize}, but I am not sure and don't know how to do that.

I would aprreciate any help, many thanks in advance!

Best Answer

You can group a \setlist. Or use the before-key to pass values to nested lists:

\documentclass[a4paper, 12pt]{report}
\usepackage[onehalfspacing]{setspace}
\usepackage{enumitem}
\renewcommand{\labelitemii}{$\diamond$}
\begin{document}
\begin{itemize}[itemsep=5pt,parsep=0pt,
                before={\setlist{itemsep=5pt,parsep=0pt}}]
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}

Back to the old values:

\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}


\begingroup
\setlist{itemsep=5pt,parsep=0pt}
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}
\end{itemize}
\endgroup

Back to the old values:

\begin{itemize}
\item item sep \the\itemsep{} and parsep \the\parsep
\end{itemize}

\end{document}
Related Question