I'm using the KOMA scrbook class to write my thesis. I have source code blocks that I wish to display with minted. An MWE can be seen here:
% Intended LaTeX compiler: pdflatex
\documentclass{scrbook}
\usepackage{listings}
\usepackage{minted}
\setminted{autogobble=true,fontsize=\small,baselinestretch=0.8,frame=lines}
\setminted[python]{python3=true,tabsize=4}
\usemintedstyle{trac}
\renewcommand{\listingscaption}{Code Snippet}
\title{MWE}
\begin{document}
\maketitle
\tableofcontents
\chapter{Test}
\begin{listing}[htbp]
\begin{minted}[]{python}
a = 2
\end{minted}
\caption{\label{example}
caption}
\end{listing}
\end{document}
And this is what the code block looks like:
How can I globally (in the preamble) reduce the distance between the listing and its caption?!
I'm looking for a solution that does not change the distance between figures or tables and their captions. I've tried using the newfloat environment as in \usepackage[newfloat]{minted}
, and then calling \captionsetup[listing]{skip=-10pt}
, but then the \renewcommand{\listingscaption}{Code Snippet}
command seems to stop having any effect.
Help and suggestions highly appreciated.