2

When an enumitem list is resumed there is some additional vertical space that is applied as can be seen in the difference in the vertical alignment of the 2nd item:

enter image description here

I assume this is related to topsep. So, I could adjust the topsep parameter manually each time I resume a list, but wondering if there is a way to define the MyEnumerate list so that the values of topsep (and perhaps any others things that need tweaking) are different for resumed lists vs. the initial (non-resumed) list.

Also, what is the correct mathematical computation of the topsep value required in terms of the other enumitem spacing parameters?

References:

Code:

\documentclass{article}
\usepackage{enumitem}

\newlist{MyEnumerate}{enumerate}{3} \setlist[MyEnumerate]{label=(\arabic)}

\begin{document} \begin{minipage}[t]{0.45\linewidth} My List of items: \begin{MyEnumerate} \item First Item. \item Second Item. \item Third Item. \item Fourth Item. \end{MyEnumerate}% End of list. \end{minipage}% \hfill% \begin{minipage}[t]{0.45\linewidth} My List of items: \begin{MyEnumerate}[series=foo] \item First Item. \end{MyEnumerate} \begin{MyEnumerate}[resume*=foo] \item Second Item (resumed). \end{MyEnumerate}% \begin{MyEnumerate}[resume*=foo] \item Third Item (resumed). \end{MyEnumerate}% \begin{MyEnumerate}[resume*=foo] \item Fourth Item (resumed). \end{MyEnumerate}% End of resumed list. \end{minipage}% \end{document}

Peter Grill
  • 223,288
  • 1
    The gap is actually \topsep+\parskip. If you place \vspace{\dimexpr-\topsep-\parskip} as the first thing inside MyEnumerate, the two align vertically. – Werner Jun 28 '14 at 18:11
  • @Werner: Indeed, that works if I place them in every resumed list (but not the initial list). Now, can I apply that when I apply a resume? – Peter Grill Jun 28 '14 at 18:17
  • note that you get the same spacing even when you remove the resume stuff – cmhughes Jun 28 '14 at 18:18
  • @cmhughes: Yep. But a new list will be proceeded by text so that is ok. So, I guess I could set something like itemsep=\dimexpr\topsep+\parskip (not quite right), but I'd prefer to leave the new list spacing as is, just tweak the resumed list spacing to match. – Peter Grill Jun 28 '14 at 18:36
  • @PeterGrill: The instance you show may be very particular, as you're actually using a list setup in 4 separate lists while representing a single list. It may be possible to patch the resume key to also adjust the topsep key, I think. – Werner Jun 28 '14 at 19:57
  • @Werner: Or perhaps defining a new key Resume instead so that other resumes are not affected. Don't think I need that, but just in case. – Peter Grill Jun 28 '14 at 20:12
  • Curiosity... Why do you want to do this? If there is no text in between, why not just continue the list? If there is text, you want the separation... I'd assumed this was meant to be used when non-list stuff intervenes. At least, that's how I've used it and I definitely want the same vertical spacing in that case. – cfr Jun 29 '14 at 00:44
  • @cfr: I guess that is one of the problems with a MWE in that the actual context gets lost. The reason I need this is that items are conditional so may not get typeset, and it is possible that the entire list is not typeset at all. This simplest way to do that seemed to me to use the resume feature. I removed that portion of the MWE as it did not seem to be needed. – Peter Grill Jun 29 '14 at 00:57
  • In which case my answer is not only uncool but won't work, I think. Should I delete it? – cfr Jun 29 '14 at 01:00
  • @cfr No need to delete it. It does work for the MWE as posted and I might end up adapting that if a solution that provides a new key such as Resume doesn't show up. – Peter Grill Jun 29 '14 at 01:22

1 Answers1

2

You could use a new environment for resuming the list. This isn't as cool as defining a new Resume key or redefining resume but...

\documentclass{article}
\usepackage{enumitem}

\newlist{MyEnumerate}{enumerate}{3}
\setlist[MyEnumerate]{label*=(\arabic*)}
\newenvironment{MyResume}[1]{%
  \begin{MyEnumerate}[resume*=#1,topsep=\itemsep,partopsep=\parsep]}{%
  \end{MyEnumerate}}

\begin{document}
\begin{minipage}[t]{0.45\linewidth}
    My List of items:
    \begin{MyEnumerate}
        \item First Item.
        \item Second Item.
        \item Third Item.
        \item Fourth Item.
    \end{MyEnumerate}%
    End of list.
\end{minipage}%
\hfill%
\begin{minipage}[t]{0.45\linewidth}
    My List of items:
    \begin{MyEnumerate}[series=foo]
        \item First Item.
    \end{MyEnumerate}
    \begin{MyResume}{foo}
        \item Second Item (resumed).
    \end{MyResume}%
    \begin{MyResume}{foo}
        \item Third Item (resumed).
    \end{MyResume}%
    \begin{MyResume}{foo}
        \item Fourth Item (resumed).
    \end{MyResume}%
    End of resumed list.
\end{minipage}%
\end{document}

Resumed list

cfr
  • 198,882