5

Consider this code

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

\setlength{\topsep}{3\baselineskip}
%\setlength{\partopsep}{3\baselineskip}

\hrulefill

\begin{enumerate}
\itemsep=20pt
\item \lipsum[2]
\item \lipsum[2]
\end{enumerate}

\end{document} 

I know there is a possibility to change \itemsep with enumitem package, but I expect there is a method to change it locally without need of packages.

Why changing the length \topsep has no effect on vertical space before and after items unlike \partopsep length ( remove % before \setlength{\partopsep}{3\baselineskip}).

7

That is because \topsep is defined by the class in an internal macro called \@listi, \@listii,\@listiii, etc, depending on the nesting depth of the list. This macro is called at the \begin{list}. On the other hand, \partopsep is defined globally in the class.

So you would have to change those macros, depending on the nesting depth. For example:

\makeatletter
\let\orig@listi\@listi
\def\@listi{\orig@listi\topsep=3\baselineskip}
\makeatother
| improve this answer | |
  • Sorry, Piet, I wasn't able to get it running. I added it in the preamble, as well as in the list itself. What am I doing wrong? – Jan Dec 31 '16 at 10:24
  • 1
    @SalimBou You have to add these lines immediately before the enumerate environment, not to the preamble. If you need them more frequently, wrap it into a new environment. When you put the patch into the preamble, it will be overwritten with every size changing command, like \normalsize issued at the beginning of the document. – gernot Dec 31 '16 at 10:56
  • @SalimBou Alternatively, replace \@listi by \@listI (capital i at the end) in the patch, then it might work when you put it into the preamble. But this will affect all list environments (in normal size), which might not be what you want. – gernot Dec 31 '16 at 10:58
  • I can embed changes of \@listi in a macro like this \def\ctopsep#1{ \let\orig@listi\@listi \def\@listi{\orig@listi\topsep=#1}} then I can use it with \ctopsep{3\baselineskip} when I need it – Salim Bou Dec 31 '16 at 11:08

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.