TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use the subfigure package of LaTeX to display a code listing. Here was my first attempt:

\subfigure[Standard approach]{
var caps = new Capabilities(Messaging);
\subfigure[Emerson approach] {
\caption{Some caption}

(All I did was change code where I would have put an \includegraphics line into text.)

I've also tried the equivalent idea using the listings package and replacing the lines in the subfigure with


But that also didn't compile.

share|improve this question

migrated from stackoverflow.com Jul 14 '11 at 0:44

This question came from our site for professional and enthusiast programmers.

What is the error given by LaTeX? – Svante Jul 13 '11 at 7:26
up vote 2 down vote accepted

your problem is a clash of the subfigure and verbatim packages. One workaround can be the following:

var caps = new Capabilities(Messaging);
\subfigure[Standard approach]{
\subfigure[Emerson approach] {
\caption{caption }

For details see the documentation for the fancyvrb package.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.