# vertical extra space below lstlisting environment inside a list environment

i want several code listings to be embedded in an item of a custom list environment. To achieve this i employ the lstlisting environment of the listings package. Unfortunately extra vertical space is appended to the lstlisting environment inside a list environment (see image below). Not a large skip but by all means annoying. This extra space vanishes if the same listing is placed outside the list environment. I can't figure out the reason for this extra space. Probably my current knowledge don't suffice to get rid of this space.

Maybe one of you experts can figure out the reason and can give me a hint how to remove the vertical extra space!? Maybe even a short explanation of this at least for the laymen strange behavior.

Thanks a lot for your effort...

Here is a minimal example which illustrates the problem:

 \documentclass[10pt]{article}
\usepackage{listings}

\lstset{frame=lines, aboveskip=0pt, belowskip=0pt}
\begin{document}
\begin{list}{}{}
\item asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd
\begin{lstlisting}
asdasd
\end{lstlisting}%
asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd
\end{list}
asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd
\begin{lstlisting}
asdasd
\end{lstlisting}%
asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd asd
\end{document}


The crucial snippet of the compiled document is shown below:

-

The behaviour you're seeing is coming from the \parsep of the list environment.

From source2e you'll see that the vertical spacing of a list environment has the following parameters that can be tweaked

The particularly relevant parameter for your example is \parsep, so if you use

\begin{list}{}{\setlength{\parsep}{0pt}}


then you get

which I think is what you want :)

-
disclaimer: I know you said you wanted an expert- I don't consider myself an expert; I know just about enough to be somewhat-useful some of the time. hopefully this is one of those times :) –  cmhughes Jul 21 '12 at 17:05
Thank you very much for your thorough explanation and the solution. Setting \parsep to 0pt solved it, like you've written. Seen from my current level your answer has definitely the expertise i was looking for. And i share your feeling, that you was useful at this instant of time as you posted this answer :) I hope that my comforting words help you to get out of your depression =) ... just kidding –  user1146332 Jul 21 '12 at 17:34