# How to use an in-line listing in a footnote or in a caption?

I use listing package and want to define a short (in-line) listing in a footnote. For example: \footnote{Java uses the |break| keyword...}. However, the compilation of the file fails, because "Argument of \lst@temp has an extra }." How can I overcome this problem?

Moreover, is there any way to use a short listing in a caption?

-
I did not get any error running this \footnote{Java uses the |break| keyword...}. I could not understand what you are trying to do with inline listing. I thought you want to create in line list like 1.a 2.b 3.c etc in footnote. can you clarify more –  Aku Jan 23 '11 at 16:43
@Aku: he is using the listings package. It works like verbatim but it also "highlights" the code according to the some programming language dependent rules. –  Jan Hlavacek Jan 23 '11 at 17:10
Please add a complete (with preamble) minimal example that illustrates your problem. –  Caramdir Jan 23 '11 at 17:55

\documentclass{article}
\usepackage{listings}
\begin{document}
a\footnote{Java uses the \lstinline|break| keyword.}
\end{document}


Works. If you're trying to do something different, please update your question with a minimal example as Caramdir suggested.

-
That works for verbatim, actually, the fancyvrb package. The question is about listings, which does more than verbatim. According to the listings manual, the listings package provides some sort of interface to the fancyvrb package, maybe that could be used. However, I really do not understand that part of the manual. It is not clear to me what is the interface supposed to do, and how would one go about using it. –  Jan Hlavacek Jan 23 '11 at 17:13