In the standard article class the distance between caption and the listing below it is fine. But when using KOMA-Script's documentclass scrartcl the vertical space is too big (see the image below). I'm using minted package and the code is inside listing environment.
Q: What is the easiest way to adjust the vertical spacing between the caption and the floating listing?
If that can be achieved without using listing environment, that is also fine. And here is the MWE:
\documentclass[12pt,a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[newfloat]{minted}
\begin{document}
\begin{listing}
\caption{Code sample}
\begin{minted}[frame=lines]{js}
function foo() {
return;
}
\end{minted}
\end{listing}
\end{document}
PS. I have identical problem with figures where the caption is too far below the figure. That might be a related case.
EDIT: I have tried to fix this using caption package with no luck. I have no idea where to look next.
EDIT2: I know some programming. So if there is a way to redefine some KOMA macros, I'd like to try it. But I don't know where to start debugging...



listingspackage butlistingenvironment which (I guess) is provided bymintedpackage. I also tried addingcaptionspackage but various skip parameters moved both the listing and the caption. – Paapaa Jul 21 '16 at 22:00