r - knitr: can I cite an article in a figure caption using the fig.cap chunk option? -


i'd cite article in figure caption. i've tried using rmarkdown/pandoc [@citekey] , latex \\citep{citekey} forms in fig.cap chunk option without luck.

here reproducible example:

--- output:   rmarkdown::tufte_handout references: - id: nobody06   title: 'my article'   author:   - family: nobody     given: jr   issued:     year: 2006 ---  text [@nobody06].  ```{r figure, fig.cap="a figure [@nobody06]"} library(ggplot2) qplot(1:10, rnorm(10)) ```  # references 

this produces correct citation in text block either [@nobody06] (when use rmarkdown form) or (?) (when use latex form) in figure caption.

here screencap: screencap.

i have tried reference in .bib , .bibtex file follows, same results:

@misc{nobody06,        author = "nobody jr",        title = "my article",        year = "2006" } 

after updating dev versions of rmarkdown (rstudio/rmarkdown@c22ee06) , knitr (yihui/knitr@b510ced) (?) both in text block , figure caption. see some text [@nobody06]. gets rendered some text \citep{nobody06}. in .tex file using dev version it's some text (nobody 2006). in release version.

does know if it's possible use citations in thefig.cap field?

r version 3.2.2 (2015-08-14) platform: x86_64-pc-linux-gnu (64-bit) running under: ubuntu 14.04.3 lts  locale:  [1] lc_ctype=en_au.utf-8        [2] lc_numeric=c                [3] lc_time=en_au.utf-8         [4] lc_collate=en_au.utf-8      [5] lc_monetary=en_au.utf-8     [6] lc_messages=en_au.utf-8     [7] lc_paper=en_au.utf-8        [8] lc_name=c                   [9] lc_address=c               [10] lc_telephone=c             [11] lc_measurement=en_au.utf-8 [12] lc_identification=c         attached base packages: [1] stats     graphics  grdevices utils     [5] datasets  methods   base       other attached packages: [1] ggplot2_1.0.1.9003  loaded via namespace (and not attached):  [1] rcpp_0.12.1      digest_0.6.8      [3] plyr_1.8.3       grid_3.2.2        [5] gtable_0.1.2     formatr_1.2.1     [7] magrittr_1.5     evaluate_0.8      [9] scales_0.3.0     stringi_0.5-5    [11] rmarkdown_0.8.1  labeling_0.3     [13] tools_3.2.2      stringr_1.0.0    [15] munsell_0.4.2    yaml_2.1.13      [17] colorspace_1.2-6 htmltools_0.2.6  [19] knitr_1.11       


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -