0

I find myself using

\begin{enumerate}[label=\alph*), topsep=-3ex]
\item ...
\end{enumerate}
~\newline

very often. Since I am using a negative value for topsep to reduce the white space above the enumeration, there is also white space missing after the enumeration. To fix that I currently add ~\newline after each enumeration block.

Now my question is: can I patch the \begin{enumerate} command or define my own command using enumerate to automatically have the white spaces I need, both before and after the first and last item respectively?

I hope my question isn't too dumb and thank you in advance for your help :).

  • 4
    Sorry, this is an XY problem, as far as I see. Am I right that your true question is: "How to have different spacing above and below enumerate"? – yo' May 29 '17 at 9:53
  • the negative topsep can not be right and will cause overprinting in some cases, similarly you can specify the vertical spacing around lists so you do not need ~\newline which does not make a space at all but starts a spurious paragraph with an invisible first line so will destroy the space at top of the page of a page break happens here, and will break the code latex uses to indent or not indent the partial paragraph after the list. the last thing you want to do is apply either of these changes by default. – David Carlisle May 29 '17 at 10:49
3

Why not simply setting \topsep to zero? And probably also \partopsep.

\documentclass{article}
\usepackage{enumitem,lipsum}
\begin{document}

\lipsum*[2]
\begin{enumerate}[label=\alph*), topsep=0pt,partopsep=0pt]
\item ...
\end{enumerate}
\lipsum[3]

\begin{enumerate}[label=\alph*), topsep=0pt,partopsep=0pt]
\item ...
\end{enumerate}

\lipsum[3]

\end{document}

enter image description here

  • If this should be applied to all enumerates then probably \setlist[enumerate]{label=\alph*), topsep=0pt,partopsep=0pt} which would answer the “How do I patch…” part – clemens May 29 '17 at 14:41
2

You can define a new environment using \newenvironment{myenum}. For details please look into any documentation, eg. http://de.sharelatex.com/learn/Environments?&nocdn=true. It may perhaps look like

\newenvironment{myenum}
   {\begin{enumerate}[Label=\alph*),tops‌​ep=-3ex]}
   {\end{enume‌​rate}}

To use it:

\begin{myenum}
   \item ...
\end{enum}

If you really want to incorporate the last line of your code snippet (why?), you may write:

\newenvironment{myenumalt}
   {\begin{enumerate}[Label=\alph*),tops‌​ep=-3ex]}
   {\end{enume‌​rate}
    ~\newline}

Please be aware that this (myenumalt) is not a canonical solution. If you need additional space after this environment there are better ways to get it (see the comment by David Carlisle above).

  • 2
    Fine, just I don't think it's good to provide answers that keep users' bad (insane) practices, such as ~\newline. If would be good to add a disclaimer that this is not what one shall do. – yo' May 29 '17 at 9:54
  • Yes, of course, so I asked him/her, why he needs (or thinks he needs) this line. I will add a few words. – Jürgen May 29 '17 at 9:56

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.