Knowing about \addvspace I wrote my own environment that adds a minimum space before and after it. But using memoir, if a \section precedes it, \addvspace always adds all its space to the space that usually follows a section. MWE:




\section{Sec 1}


\section{Sec 2}


\section{Sec 3}

\section{Sec 4}


You can see that the second section has way too much vspace after it. I had a look at the memoir \@startsection code and found that it does (rightly) use \vskip and \addvspace. After reading this question I suspect it is maybe a \noindent problem since \@afterindent is used. But there must be a trick somewhere that I am missing because Sec 3 and Sec 4 have the proper space. Any ideas of how to fix this?

  • 2
    The problem is that the last skip called by \section is \vskip-\parskip which is 0pt plus -1pt and so when \addvspace tests whether the last skip is zero (in which case it always adds its space), the test will be true because the first component of the skip is 0pt (the plus part is discarded). To solve your problem, you can put an \unskip just before your \addvspace. Oct 7, 2012 at 7:07
  • Hm.. it sounds promising, but it doesn't quite work yet: it breaks with "You can't use \unskip in vertical mode." Is there an equivalent for vertical mode? And a conditional one that only unskips if the \vskip was 0pt?
    – MiB
    Oct 7, 2012 at 14:59
  • @MiB: Sorry, I should have mentioned it, but for \unskip to work, you mustn't leave a blank line before it (so it's more a one time quick fix than a real solution). Oct 7, 2012 at 18:24

1 Answer 1


Aha! Thanks to the tip from Philippe I found the following solution:


         {}{\typeout{WARNING! Patching \noexpand\@xsect failed!}}

\@xsect didn't use \addvspace but plain \vskip. Changing that fixes my problem.

You must log in to answer this question.

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