2

I want to have a non-zero \parskip between the paragraphs, but avoid having it around the "inline" itemize.

I could temporarily change it around each environment, but I have a lot of them in my document. I could also redefine the itemize environment and introduce a \vspace*{-\parskip}, but I'd prefer a cleaner way. Changing \parskip inside the environment is useless as it only works inside the group.

\documentclass{article}
\begin{document}
\parskip=6pt
Praesent hendrerit velit at magna tempus, at malesuada augue lacinia. Pellentesque at malesuada est, vel varius enim. In egestas massa et finibus ultricies. Donec felis erat, placerat et sodales in, egestas non mi.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
% >> no parskip here
\begin{itemize}
  \item first
  \item second
\end{itemize}
% >> no parskip here
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}

Packages like paralist and enumitem did not seem to solve the problem in presence of \parskip.

0
3

latex uses \topsep as the local version of \parskip in that context so just set \parsep to whatever you need, however if setting without using enumitem or similar package you need to set it indirectly as article sets up each first level list using a predefined set of parameters.

\documentclass{article}
\setlength\parskip{6pt}

\makeatletter
\def\@listI{\leftmargin\leftmargini
            \parsep 4\p@ \@plus2\p@ \@minus\p@
%            \topsep 8\p@ \@plus2\p@ \@minus4\p@
            \topsep\z@
            \itemsep4\p@ \@plus2\p@ \@minus\p@}
\makeatother
\begin{document}

Praesent hendrerit velit at magna tempus, at malesuada augue lacinia. Pellentesque at malesuada est, vel varius enim. In egestas massa et finibus ultricies. Donec felis erat, placerat et sodales in, egestas non mi.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
% >> no parskip here
\begin{itemize}
  \item first
  \item second
\end{itemize}
% >> no parskip here
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document}

or perhaps you want

            \topsep-6pt

depending how tight you want the spacing.

5

You also can easily do that with enumitem:

\documentclass{article}
\usepackage{enumitem} %
\newlength\docparskip
\parskip=6pt
\setlength{\docparskip}{\parskip}
\setlist{nosep, itemsep=0pt, parsep=0pt, before={\parskip=0pt}, after=\vspace{-\docparskip}}%
\begin{document}
Praesent hendrerit velit at magna tempus, at malesuada augue lacinia. Pellentesque at malesuada est, vel varius enim. In egestas massa et finibus ultricies. Donec felis erat, placerat et sodales in, egestas non mi.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
% >> no parskip here
\begin{itemize}
  \item first
  \item second
\end{itemize}
% >> no parskip here
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

% >> parskip here!
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\end{document} 

enter image description here

5
  • Well, this does not give me 0pt space around the list. Lists seem to use \parskip + \topsep + [\partopsep] to produce vertical spacing around the environment. However, setting \topsep to negative value should fix it.
    – ftynse
    Sep 5 '16 at 11:38
  • I didn't understand you didn't want the ‘normal’ parskip either.
    – Bernard
    Sep 5 '16 at 11:42
  • 1
    @ftynse: I've modified my code. Is it like what you want now?
    – Bernard
    Sep 5 '16 at 12:06
  • It does produce the output I wanted, but still uses \vspace. David's suggestion with negative \topsep should work with \setlist{topsep=-6pt} I suppose.
    – ftynse
    Sep 6 '16 at 9:26
  • 1
    I had to use \vspace because you can't prevent what follows a list environment to be considered a new paragraph, so that \parskip is applied. Writing \topsep=-\parskip amounts to the same.
    – Bernard
    Sep 6 '16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.