I am writing a document in which code listings and diagrams appear side-by-side frequently. I am using the listings package for the code and \includegraphics for the diagrams. I want to put them both on the same figure. I tried the subfigure package, but it does not allow verbatim environments inside the \subfigure{} argument.
The fancyvrb package has a workaround for this limitation: Using SaveVerbatim and \BUseVerbatim. However, I prefer to use only the listing package to get uniform styling for my code listings.
The subfigure manual includes some voodoo definition of a subfloat environment which can contain minipages with verbatim content. It is a clumsy solution. I also wonder why this solution was left out of the package itself.
Does anyone know a simple way to make these packages work together? Alt., is there a sub-figures package that is more verbatim-friendly?