I'd like to cite an article in my figure caption. I've tried using the Rmarkdown/pandoc [@citekey] and the latex \\citep{citekey} forms in the fig.cap chunk option without any luck.
Here is a reproducible example:
---
output:
rmarkdown::tufte_handout
references:
- id: Nobody06
title: 'My Article'
author:
- family: Nobody
given: Jr
issued:
year: 2006
---
Some text [@Nobody06].
```{r figure, fig.cap="A figure [@Nobody06]"}
library(ggplot2)
qplot(1:10, rnorm(10))
```
# References
This produces the correct citation in the text block but either [@Nobody06] (when I use the RMarkdown form) or (?) (when I use the Latex form) in the figure caption.
Does anyone know if it's possible to use citations in thefig.cap field?


fig.cap = "A figure \\label{refkey}", then\ref{refkey}. You may need to runpdflatextwice on the LaTeX output. I haven't tested it, though. - Yihui Xie\\citep{Nobody06}in the figure caption, but you have to compile the LaTeX document by yourself since Pandoc cannot resolve citations generated by\cite{}by default. Or just use the development version of rmarkdown. - Yihui Xiedevtools::install_github('rstudio/rmarkdown')which installedrstudio/rmarkdown@eaee966, but now I get(?)in both the text block and the figure caption. I see that this is now being rendered asSome text \citep{Nobody06}.in the.texfile, where it was previously being rendered asSome text (Nobody 2006). I'm also getting a.bblfile generated in the directory but it is zero bytes. - Tom Harropreferencesin YAML. I was only considering usingbibliographyin YAML with a .bib file. In the case ofreferences, I don't think there is anything we can do in rmarkdown -- it is totally up to Pandoc whether it can parse and render citations in figure captions. I'm not sure if the .bib approach works, though. - Yihui Xie