4

If I do the following:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{enumitem}
\setstretch{2}
\setlist[itemize]{topsep=.1em,itemsep=.1em,parsep=0em,partopsep=0em}
\setlist*[itemize]{first=\setstretch{1}}    % This undesirably affects the spacing before the list

\begin{document}

\def\text{test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph}

\text

\begin{itemize}
\item one
\item two
\item three
\end{itemize}

\text

\end{document}

Then I get:

bad spacing between list and previous paragraph

But that is not what I want. I want to keep the spacing just before the list unchanged, but change only the spacing between lines of the list. Is there any way I can automatically achieve this for all itemize/enumerate lists, regardless of the interline-spacing of their surrounding text?

10
  • 4
    Coukd you please post a small, yet complete, example code?
    – Bernard
    Apr 13, 2022 at 18:07
  • @DavidCarlisle: first=\par\setstretch causes a compile error...
    – user21820
    Apr 13, 2022 at 18:20
  • use \setlist*[itemize]{first=\singlespacing}. Apr 13, 2022 at 18:52
  • @DavidCarlisle: Why do we need \endgraf instead of \par?
    – user21820
    Apr 13, 2022 at 19:07
  • 1
    ah before and \endgraf then:-), incidentally do you really want setstretch{2} it is so spacy to be hardly readable, and way more than "doublespaced" (eg the setspace package uses \setstretch {1.667} for \doublespace Apr 13, 2022 at 19:24

3 Answers 3

4

On way is simply to adjust for the changed baseline:

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{enumitem}
\setstretch{2}
\setlist[itemize]{topsep=.1em,itemsep=.1em,parsep=0em,partopsep=0em}
\setlist*[itemize]{first=\vspace{\baselineskip}\setstretch{1}\vspace{-\baselineskip}}    % This undesirably affects the spacing before the list

\begin{document}

\def\text{test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph}

\text

\begin{itemize}
\item one
\item two
\item three
\end{itemize}

\text

\end{document}
7
  • Oh I didn't see your answer while I was typing mine. Comparing, is there a benefit to using \vspace instead of \vskip for the first spacing?
    – user21820
    Apr 13, 2022 at 20:06
  • @user21820 \vspace is latex, \vskip is a tex primitive so not really at the same level as an enumitem keyval setting (but does same thing) Apr 13, 2022 at 20:56
  • Hmm, I read this which claimed a whole bunch of differences, so I wasn't sure. It seems like my choice of \vskip may be better aligned with the notion of changing line-spacing, but I'm not sure.
    – user21820
    Apr 13, 2022 at 20:58
  • @user21820 I am sure Apr 13, 2022 at 21:01
  • Lol so it yields identical results in all cases? Why? Can you briefly explain why "The former will not force end-of-paragraph" from the linked post does not apply here?
    – user21820
    Apr 13, 2022 at 21:05
3

How about this, using the before and after keys?

    \documentclass{article}
    \usepackage[T1]{fontenc}
    \usepackage{setspace}
    \usepackage{enumitem}
    \setstretch{2}
    \setlist[itemize]{topsep=.1em, itemsep=.1em,parsep=0em, partopsep=0em}
    \setlist[itemize]{before=\begin{singlespace}, after=\end{singlespace}}

    \begin{document}

    \def\text{test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph}

    \text

    \begin{itemize}
    \item one\text
    \item two
    \item three
    \end{itemize}

    \text

    \end{document} 

enter image description here

4
  • No, this fails to address my question; I said "regardless of the interline-spacing of their surrounding text". So your proposal fails in many many situations, including but not restricted to nested lists.
    – user21820
    Apr 13, 2022 at 19:08
  • 2
    I'm afraid there's no obvious solution about the spacing of the list w.r.t. the surrounding text. Maybe some guru (which I'm not) will find something…
    – Bernard
    Apr 13, 2022 at 19:18
  • See my answer. Yours isn't an answer at all (see the nested lists in mine), and I think you should delete it.
    – user21820
    Apr 13, 2022 at 20:09
  • Your last edit (after my previous comments) does make your post an answer to my question (and works with nested lists), but is not general at all. It also fails in some special cases (e.g. if there is no empty line before the \begin{itemize}), which is the reason the first key is correct and your choice of before key is wrong. So clearly there is something very wrong with the voters on TeX SE.
    – user21820
    Apr 14, 2022 at 9:28
0

After a commenter suggested \singlespacing, I looked at its definition and I think the following works in all cases:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{enumitem}
\setstretch{2}
\setlist[itemize,enumerate]{topsep=.1em,itemsep=.1em,parsep=0em,partopsep=0em}
\setlist*[itemize,enumerate]{first=\vskip\baselineskip\setstretch{1.1}\vspace{-\baselineskip}}

\begin{document}

\def\text{test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph test paragraph}

\text

\begin{itemize}
\item one
\item two
\item three
    \begin{enumerate}
    \item a
    \item b
    \end{enumerate}
\item four
\end{itemize}

\text

\end{document}

The 1.1 can obviously be changed arbitrarily. It produces:

proper spacing before list

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .