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
\addvspace\medskipamount
\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}[caption={cap},label=lbl]
...
\end{lstlisting}
Where cap
and lbl
are different captions/labels, so they are not constant for all listings.
\addvspace\medskipamount
? Don't understand your question really well though. Or maybe a\vskip5pt
. Is this a horizontal space or vertical space?\newenvironment
or a\newcommand
like\newcommand{\mylist}[1]{\addvspace\medskipamount \begin{lstlisting} {#1} \end{lstlisting}}
listings
providesaboveskip
andbelowskip
, both of which are\medskipamount
by default. You could increase this using\lstset{aboveskip=\bigskipamount, belowskip=\bigskipamount}
in your document preamble.