# How can I use \belowcaptionskip with listing?

\documentclass{mwrep}
\usepackage{minted}
\usepackage{lipsum}

% question regarding this code
\setlength{\belowcaptionskip}{-10pt}
% end

\begin{document}
\lipsum[1]
\begin{listing}[h]
\begin{verbatim}
1
2
3
4
\end{verbatim}
\caption{test}
\label{lst}
\end{listing}
\lipsum[2]
\begin{figure}[h]
\begin{verbatim}
1
2
3
4
\end{verbatim}
\caption{test}
\label{ver}
\end{figure}
\lipsum[3]
\end{document}


Why does \listing ignore change of \belowcaptionskip? What can I change to make listing affected by it as in case of figure?
How can I make caption of listing be identical with caption of figure in every manner (like fontsize, which on my example is smaller in figure).

-

The mwrep document class redefines the way \caption behaves for standard floats (i.e., table and figure); the minted package defines its listing environment using the features provided by the float package; as a result, the redefinition of mwrep doesn't apply to the listings environment; one way to solve the problem is to \restyle the listing float to use the settings that mwrep uses (in particular, \captionsettings); here's such an example illustrating this approach with a modified version of the plain float style as defined by the float package:

\documentclass{mwrep}
\usepackage{minted}
\usepackage{lipsum}

\setlength{\belowcaptionskip}{-10pt}

\makeatletter
\renewcommand\floatc@plain[2]{\setbox\@tempboxa\hbox{\captionsettings{\@fs@cfont #1:} #2}%
\ifdim\wd\@tempboxa>\hsize \captionsettings{\@fs@cfont #1:} #2\par
\else\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi\vskip\belowcaptionskip}
\makeatother

\floatstyle{plain}
\restylefloat{listing}

\begin{document}
\lipsum[1]
\begin{listing}[h]
\begin{verbatim}
1
2
3
4
\end{verbatim}
\caption{test}
\label{lst}
\end{listing}
\lipsum[2]
\begin{figure}[h]
\begin{verbatim}
1
2
3
4
\end{verbatim}
\caption{test}
\label{ver}
\end{figure}
\lipsum[3]
\end{document}


-