# [Tex/LaTex] Increase space between listings env. and surrounding text

listingsspacing

How can I set the space between a listing (lstlisting) and text that surrounds it? Is there a parameter I can set at the beginning of my document, that controls this? I tried framesep, but it just inflates the frame box.

EDIT:

text
\begin{lstlisting}
...
\end{lstlisting}


\addvspace does what I need. How do I set this at the beginning of the document, so I don't have to add this manually to every listing?

EDIT:

I use listings like so:

\begin{lstlisting}
...
\end{lstlisting}


Where cap and lbl are different captions/labels, so they are not constant for all listings.

Use the \lstset command and its aboveskip and belowskip keys. See section 4.3 of the manual for details.

\documentclass{article}

\usepackage{listings}

\lstset{aboveskip=20pt,belowskip=20pt}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{lstlisting}[caption={A listing}]
(Listing contents)
\end{lstlisting}

\lipsum[2]

\end{document}