1

When using minted, the spaceing below and above the code is too high. In comparsion when using a new created environment (mintedlisting) with the package caption, the spaceing seems to be right but the text won't "wrap" around the code anymore, a paragraph is inserted instead (see picture).

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[newfloat=true]{minted}
    \SetupFloatingEnvironment{listing}{placement=h, name=Source code}
\usepackage[babel,strict=true,autostyle=true]{csquotes}
\usepackage{listings}
    \renewcommand{\lstlistingname}{Source code}
\usepackage{caption}
    \newenvironment{mintedlisting}{\captionsetup{type=lstlisting}}{}
\usepackage{blindtext}

\begin{document}

\blindtext
%
\begin{listing}
\caption{Description.}
\begin{minted}{Python}
print('hello world')
\end{minted}
\end{listing}%
%
\blindtext
%
\begin{mintedlisting}
\caption{Description.}
\begin{minted}{Python}
print('hello world')
\end{minted}
\end{mintedlisting}%
%
\blindtext

\end{document}

Is there a way to use the exact spacing from mintedlisting environment and wrap the text around like minted does?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.