I am trying to add a title with counter to my Listings. This is what I have so far:
\usepackage{listings}
\usepackage[many]{tcolorbox}
\tcbuselibrary{listings}
\newtcblisting[auto counter,number within=section]{cpp}[2][]{
title={Listing \thetcbcounter: #2},
colback=white,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
top=0pt,
bottom=0pt,
colframe=white,
listing only,
left=15.5pt,
enhanced,
listing options={
basicstyle=\footnotesize\ttfamily,
keywordstyle=\color{blue}\ttfamily,
stringstyle=\color{red}\ttfamily,
commentstyle=\color{green}\ttfamily,
breaklines=true,
language=C++,
showstringspaces=false,
tabsize=2,
numbers=left
},
overlay={
\fill[gray!30]
([xshift=-3pt]frame.south west)
rectangle
([xshift=11.5pt]frame.north west);
}
}
\newtcblisting[auto counter,number within=section]{logs}[2][]{
title={Listing \thetcbcounter: #2},
colback=white,
boxrule=0pt,
arc=0pt,
outer arc=0pt,
top=0pt,
bottom=0pt,
colframe=white,
listing only,
left=15.5pt,
enhanced,
listing options={
basicstyle=\scriptsize\ttfamily,
breaklines=true,
showstringspaces=false,
tabsize=2,
numbers=left
},
overlay={
\fill[gray!30]
([xshift=-3pt]frame.south west)
rectangle
([xshift=11.5pt]frame.north west);
}
}
But the problem is that the title is colored white (I marked it that you can see it) and the gray bar on the left is going all the way up beside the title like that:
\begin{logs}{iwconfig Aufruf}
root:~> iwconfig eth0
eth0 IEEE 802.11-bgn ESSID:off/any
Access Point: Not-Associated Bit Rate=0 kb/s
\end{logs}
The second problem is that I want the two different Listings handle the numbers in common, but each listing is using its own counter.
I tried to use this post here but did not get it working..

