TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having with spacing between paragraphs in my document, and I think I have been able to trace back to a custom environment I have defined.


The \ignorespacesandallpars command is by Martin Scharrer and comes from a previous StackExchange question.

(I know that there are many other ways - packages, or the definitions in amsmath - to get this sort of environment, but I have not yet found something that I'm completely happy with, and it is easier at the moment to use a custom definition.)

After I use this definition, I think I notice spacing being a bit wacky, and requiring additional \smallskip or \medskip commands. I wonder what I am doing wrong.

Is my problem somewhere else, or am I doing something wrong here?

UPDATE: The following snippet illustrates one of the problems (the spacing before the second itemize list is not the same than the first):

enter image description here




Following is an item list
\item One
\item ...

  Now a remark.

And another item list
\item One
\item ...

share|improve this question
Thanks for the code. Why are you using \@afterindentfalse\@afterheading? – Gonzalo Medina Aug 21 '12 at 19:45
@GonzaloMedina: if I recall correctly, what I wanted is to prevent the following paragraph from having indent, and to make it so no amount of spacing would change this (the fact that what follows not be indented). – Jérémie Aug 21 '12 at 21:37

Well \@afterheading is one of the reasons sectioning commands should never be used in groups ;-)

It gobally sets \@nobreaktrue and then locally sets \everypar to undo it. So after the end of your environment (undoing the \everypar setting) you have \@nobreaktrue sitting there waiting for the next list to catch it...

And \@nobreak makes a list not insert \topsep...

To avoid this mess, you must make sure \@afterheading is called outside your environment.

Replacing \@afterheading with \aftergroup\@afterheading in your definition moves the \@afterheading outside the group defined by your environment and makes \topsep reappear.

share|improve this answer
Thank you so much! It works... But I admit I don't exactly understand why (in the same way I didn't understand why the command I pasted above does what I want it to do :-). Could you perhaps elaborate on why using \aftergroup solves my problem? – Jérémie Aug 21 '12 at 20:19
@Jérémie I tried, but I'm afraid I have to suggest if all these @-commands sound greek to you, you should better leave them alone. LaTeX is famous for strange side effects of some internal commands, so they should only be used by those who know exactly what they are doing. – Stephan Lehmke Aug 21 '12 at 20:25
I think I've been using LaTeX for far too long enough to not know about these internal commands, but I can't find a coherent documentations on them! – Jérémie Aug 21 '12 at 20:28
@Jérémie source2e is a good documentation for internal stuff. – Stephan Lehmke Aug 21 '12 at 20:37
@Jérémie I think a lot of people are wondering why you are using \@afterheading in this place. See also Gonzalo Medina's comment. – Stephan Lehmke Aug 21 '12 at 20:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.