[Tex/LaTex] Modifying whitespace before and after list separately using enumitem package

enumitemlistsspacing

I use the enumitem package to modify the amount of space related to lists. One of the options this package can easily modify is topsep. However, this variable controls the vertical space both before and after a list. I can manually add back some space after the list, but this is just a hack.

\documentclass{article}
\usepackage{enumitem}
\setlist{noitemsep}
\begin{document}
I like the lack of vertical space between the end of this paragraph and the beginning of the following list.

\begin{itemize}[topsep=0pt]
 \item Item 1
     \item Item 2
    \end{itemize}

I don't like the lack of vertical space between the end of the previous list and the beginning of this paragraph.

I don't like the lack of vertical space between the end of this paragraph and the beginning of the following list.

\begin{itemize}
 \item Item 1
 \item Item 2
    \end{itemize}

I like the vertical space between the end of the previous list and the beginning of this paragraph.

To get the best of both worlds,
I use a baseline skip after the list.

\begin{itemize}[topsep=0pt]
 \item Item 1
 \item Item 2
\end{itemize}
\vspace*{\baselineskip}

Now there is a good amount of space between the end of the previous list and the beginning of this paragraph,
but a bit too much and achieved via a ``hack''.
\end{document}

enter image description here

Question

How can I use this package to modify the amount of space before and after separately?

Best Answer

You can use before=<code> and / or after=<code> to put the space/some latex code. If you use

\setlist{nosep,after=\vspace{\baselineskip}}

we get

enter image description here

Code:

\documentclass{article}
\usepackage{enumitem}
\setlist{nosep,after=\vspace{\baselineskip}}
\begin{document}
I like the lack of vertical space between the end of this paragraph and the beginning of the following list.

\begin{itemize}
 \item Item 1
 \item Item 2
\end{itemize}

I don't like the lack of vertical space between the end of the previous list and the beginning of this paragraph.

I don't like the lack of vertical space between the end of this paragraph and the beginning of the following list.

\begin{itemize}
 \item Item 1
 \item Item 2
\end{itemize}

I like the vertical space between the end of the previous list and the beginning of this paragraph.

To get the best of both worlds,
I use a baseline skip after the list.

\begin{itemize}
 \item Item 1
 \item Item 2
\end{itemize}
%\vspace*{\baselineskip}

Now there is a good amount of space between the end of the previous list and the beginning of this paragraph,
but a bit too much and achieved via a ``hack''.
\end{document}

If you want to override this for one itemize environment, use

\begin{itemize}[after=]
Related Question