31

In Latex, I want to add a reference in the legend of a figure, like:

\begin{figure}
   ...
   \caption{This is the legend of this figure (reprinted from \cite{something}).}
   ...
\end{figure}

but the citation is not allowed to be placed in the the caption, only in the text. My bibliography is working on any other places of the text.

Any suggestions how to do this?

Thanks

Machavity
  • 30,841
  • 27
  • 92
  • 100
Sérgio
  • 1,093
  • 1
  • 9
  • 14

2 Answers2

57

Solution found: write \protect\cite{ref} instead of just \cite{ref}

Or even shorter: '{\cite{ref}}'

Community
  • 1
  • 1
Sérgio
  • 1,093
  • 1
  • 9
  • 14
  • 3
    Don't know about PdfLaTeX, but this is not working in `xelatex`. – Subhamoy S. Nov 04 '14 at 15:52
  • This did solve the problem for me when I used `pdflatex`. – Tom Jul 05 '15 at 09:33
  • 1
    For me (pdflatex), \protect worked, but enclosing in {} didn't – drevicko Oct 25 '15 at 19:51
  • Also works for hyperlinks -- \protect\hyperlink{supp1}{Supplemental link 1} instead of \hyperlink{supp1}{Supplemental link 1} – maia Jul 05 '16 at 23:09
  • `{\protect\autocite{ref}}` (using BibLaTeX) worked fine with XeLaTeX. So, putting `\protect` and the citation command in a pair of curly braces, i.e. `{\protect\cite{ref}}`, will also work fine with XeLaTeX. – Carlos Luis Rivera Jan 19 '22 at 07:54
7

As the accepted answer seems rather hacky (and also didn't work for me) I will post my solution for the problem:

\begin{figure}
  ...
  \caption[Cap for listoffigures]{Cap below figure with cite \cite{source}}
  ...
\end{figure}

This compiles without errors and warnings.

mgttlinger
  • 1,435
  • 2
  • 21
  • 35
  • 1
    I am compiling with xelatex and I can see no citation in the caption. Enclosing it in `\protect{}` has no effect either. – Subhamoy S. Nov 04 '14 at 15:51
  • @SubhamoyS. `{\protect\autocite{ref}}` (using BibLaTeX) worked fine with XeLaTeX. So, putting `\protect` and the citation command in a pair of curly braces, i.e. `{\protect\cite{ref}}`, will also work fine with XeLaTeX. – Carlos Luis Rivera Jan 19 '22 at 07:57