Hi there, i have some problems with modifying a caption which belongs to a listing.
The current result is shown in picture.
What i would like to change, can be seen in the second picture.
As you can hopefully see, I'd like to place Listing 1: Nicht implementierte Funktion
at the left margin.
Furthermore I'd like to write the caption in a colorbox. (in the second picture the caption Listing 1: Nicht implementierte Funktion
has also a grey background) This colorbox should have the size from the left to the right margin (same as the listing)
My code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{color}
\definecolor{bg}{rgb}{0.85,0.85,0.85}
\usepackage[most]{tcolorbox}
\tcbset{
frame code={}
center title,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
colback=gray!70,
colframe=white,
width=\dimexpr\textwidth\relax,
enlarge left by=0mm,
boxsep=0pt,
arc=0pt,outer arc=0pt,
}
\usepackage[newfloat]{minted}
\usepackage{caption}
\newenvironment{code}{\captionsetup{type=listing}}{}
\begin{document}
\begin{code}
\captionof{listing}{Nicht implementierte Funktion}
\label{code:comp area listing}
\begin{minted}[linenos, bgcolor=bg]{python}
def komplizierte_funktion(a, b):
raise NotImplementedError('Noch nicht implementiert.')
\end{minted}
\end{code}
\end{document}