I use the caption package to add a captionof{lstlisting} to a tikz image. I do this to highlight code/place listings side by side (packages used are: tikz/listings/caption). The normal listingcaptions have a title of the form "CODE No: My Caption text", the captions created with the captionof command however lack the No bit. I would like to know how to add the number back into the caption. I noticed however that the captionof command increases the counter, in the minimal example the listing, comming after the picture captioned as listing, is labeld with the no 2.
Geetings ted
(almost) minimal example
Code: Select all
\documentclass{scrreprt}
%\input{conf/xcolor_ppt}
\usepackage{listings}
%\input{conf/listings}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usepackage{listings}
\usepackage{caption}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\end{tikzpicture}
\captionof{lstlisting}[short]{long}
\end{figure}
\begin{lstlisting}[caption=demo]
asd
\end{lstlisting}
\end{document}