Using enumerate environment in a figure caption

1,788

Try as

\caption[]{
Here I want the enumerate
\begin{enumerate*}
\item Item X
\item Item Y and
\item Item Z
\end{enumerate*}
}
Share:
1,788

Related videos on Youtube

Daniel Valencia C.
Author by

Daniel Valencia C.

Updated on July 12, 2020

Comments

  • Daniel Valencia C.
    Daniel Valencia C. over 3 years

    I'm trying to create an inline list into a figure caption like this:

    \documentclass{article}
    \usepackage[inline]{enumitem}
    \usepackage{caption}
    \usepackage{subfig}
    \begin{document}
    
    \begin{enumerate*}
    \item Item X
    \item Item Y and
    \item Item Z
    \end{enumerate*}
    
    \begin{figure}
    \captionsetup{singlelinecheck=off}
    \centering
    \subfloat{}
    \subfloat{}
    \subfloat{}
    \caption{
    Here I want the enumerate
    \begin{enumerate*}
    \item Item X
    \item Item Y and
    \item Item Z
    \end{enumerate*}
    }
    \end{figure}
    
    \end{document}
    

    I use this answer, but I got the following error:

    Argument of \caption@ydblarg has an extra }. }
    

    How can I solve it?

    • Bernard
      Bernard over 6 years
      No problem if you add an optional argument of \caption without the list.
    • gusbrs
      gusbrs over 6 years
      This is precisely the same issue as the one in the question you linked to. And, as Bernard's comment says, has also the same solution. Did you get the point of Leo Liu's answer?
    • cfr
      cfr over 6 years
      You really don't need \subfloat or subfig here. If you're using a single caption, you don't need sub-figures.
    • cfr
      cfr over 6 years
      Make sure that you delete generated files before recompiling after adding the optional argument e.g. .lof, .aux etc.
  • TeXnician
    TeXnician over 6 years
    Please elaborate on what you've done here and why it works. That should not take too long, but improves the answer a lot.
  • Dr Krishnakumar Gopalakrishnan
    Dr Krishnakumar Gopalakrishnan over 5 years
    The side effects of this must be mentioned by the community member who answered this. This removes the corresponding figure's entry from the list of figures for the document.
  • MadyYuvi
    MadyYuvi over 5 years
    @Krishna Yes, it affects the "LOF", thanks for pointing out...