I want to create a list of all listings. Listings itself allows to add captions and list them in a list using \lstlistoflistings, but they can not float. If I set up such a floating environment using floatrow they belong to a different list and the number of the caption is wrong. I would like to have the numbers correct in one numbering scheme and add both to the List of Listings.
The caption of the first one is "Listing 1: "
The caption of the second one is "Code 0.0.1: "
\documentclass{scrbook}
\usepackage{listings}
\usepackage{floatrow}
\DeclareNewFloatType{Code}%
{placement=tbhp,within=section,fileext=loc}
\begin{document}
\begin{lstlisting}[caption={LaTeX Listings}]
\begin{document}
\chapter{Introduction}
Some text ...
\chapter{Theory}
\end{document}
\end{lstlisting}
\begin{Code}[H]
\begin{lstlisting}[language={[Visual]Basic}]
Sub Main()
MsgBox "Hallo Welt!"
End Sub
\end{lstlisting}
\caption{Hello World in Visual Basic 6}
\label{lstLaTeXLinesOfCode2}
\end{Code}
\lstlistoflistings
\listof{Code}{List of Code listings}
\end{document}
