Tell me more ×
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.

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?

share|improve this question
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

2 Answers

\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.

share|improve this answer

See How to include verbatim in a figure caption?

share|improve this answer
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

Your Answer

 
discard

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.