1 Answer
1

verbatim uses trivlist which adds above and below it the current values of \topsep and \partopsep (the latter if at the beginning of a paragraph); since the trivlist is started when a group has already been opened by verbatim, it's safe to set locally the values: the command to patch is \@verbatim, that starts with \trivlist, so we can set the parameters just before this command:

fantastic! thank you! do you happen to have a version that works with enumitem up your sleeve? :)
–
Richard HansenFeb 3 '12 at 23:30

@RichardHansen It's not clear what you are asking.
–
egregFeb 3 '12 at 23:39

The enumitem package apparently modifies \trivlist to restore spacing to defaults. This allows it to modify the spacing for normal lists without affecting spacing for verbatim and others. Unfortunately, it means that your solution won't work if enumitem is in use.
–
Richard HansenFeb 3 '12 at 23:45

@RichardHansen I get identical results with enumitem; can you add an example to your question?
–
egregFeb 4 '12 at 0:11

1

I was wrong---it's not enumitem's fault. The verbatim still has space above and below when in a list environment (see edited question). Your solution reduces that space, but there's still some there. I'm guessing something else is responsible for that space...
–
Richard HansenFeb 4 '12 at 6:24