I've defined | as a "short inline character", using


I'd like to use that delimiter to typeset inline code in a footnote or a caption, e.g.

\footnote{Java uses the |break| keyword...}.

However, upon compilation, I get the following error:

Argument of \lst@temp has an extra }.

How can I overcome this problem?

  • 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

Footnotes, by default, cannot contain "naked" verbatim content. However, loading the bigfoot package, for instance, will allow you to use a single-character shorthand for inline listings (such as |) in footnotes without any problem.

Typesetting an inline listing in a caption using a single-character shorthand is more difficult; see, for instance, verb inside lstlisting caption. You're probably better off using \lstinline instead.

enter image description here





... some table ...

Here is some tidbit about |break| but that's not the whole story.%
\footnote{Java uses the |break| keyword.}
| improve this answer | |
a\footnote{Java uses the \lstinline|break| keyword.}

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

| improve this answer | |

See How to include verbatim in a figure caption?

| 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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