TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Is there a reason why I find it hard to put inline lists in figure captions?

I've defined this:

\newcommand{\inlinelist}[1]{\begin{inparaenum}[(a)] #1 \end{inparaenum}}

But I can't see anything wrong with it. It only seems to be a problem in captions.

share|improve this question
Most probably you are not protecting \inlinelist and probably other commands. However, I would like to see a full minimal example of your code. – Gonzalo Medina Mar 31 '12 at 21:51
up vote 5 down vote accepted

Actually, there's nothing wrong per se with you're trying to do. The thing that's tripping you up, though, is that the argument of the \caption command can't have what LaTeX calls "moving" or "moving" parts. To make fragile commands "robust," one can prefix them with a \protect command.

A separate comment: If there's a chance that you'll need to create a "list of figures" (which can be accomplished with the \listoffigures command), you should provide a "short" version of the caption text in the optional argument of the \caption command. Otherwise, you'll get more cryptic error messages, this time of the form Argument of \@caption has an extra }. The way to get around that is to create a short version of the caption without any "moving" commands at all, as the following MWE shows.

\newcommand{\inlinelist}[1]{\begin{inparaenum}[(a)] #1 \end{inparaenum}}


\caption[Hello and Goodbye]% 
     \protect\item Hello. 
     \protect\item Goodbye.}%

enter image description here

share|improve this answer
If the OP is using \items in the argument of \inlinelist, then \items will also have to be \protected. – Gonzalo Medina Mar 31 '12 at 21:56
@GonzaloMedina -- good point. I'll be sure to mention this in an addendum to my answer. – Mico Mar 31 '12 at 22:34
@Mico Addendum? I think it should be in a footnote:) – Yiannis Lazarides Apr 1 '12 at 6:18
@YiannisLazarides: footnote or addendum? I've decided to bypass this deep issue by rewriting my answer entirely (now with more information on how to make the caption suitable for processing by the \listofigures command... – Mico Apr 1 '12 at 11:09
@Mico Good answers both in the main post and in the comments:) – Yiannis Lazarides Apr 1 '12 at 11:13

You give only fragments of the information needed to answer the question. But the problem seems to be you're dealing with a lot of fragile commands in a moving argument. Try



\DeclareRobustCommand{\inlinelist}[1]{\begin{inparaenum}[(a)] #1 \end{inparaenum}}

  \caption{\inlinelist{\protect\item foo\protect\item bar}}

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.