【问题标题】:citing within a figure caption using r markdown使用 r markdown 在图形标题中引用
【发布时间】:2018-05-03 11:17:38
【问题描述】:

我正在使用 R markdown 和 bookdown 来创建 pdf 输出。据我从questiongithub issue 可以看出,我使用了正确的语法,但它对我不起作用,我只是在标题中得到“[@citation]”作为文本返回。 是否有特定的 yaml、块选项或包我需要让它工作?

---
title: "caption citation test"
output:
  bookdown::pdf_document2
bibliography: Bibliography_mini.bib
---

```{r echo=FALSE,warning=FALSE}
 library(knitr)
 library(kableExtra)
  opts_chunk$set(fig.path='figure/graphics-', 
                 cache.path='cache/graphics-', 
                 fig.align='center',
                 external=TRUE,
                 echo=TRUE,
                 warning=FALSE,
                 fig.pos='H'
                )
  a4width<- 8.3
  a4height<- 11.7
```
Some text here look the citation works [@moravec1980obstacle]

```{r moravec, echo=FALSE, fig.cap="look the citation doesn't work 
[@moravec1980obstacle]"}
knitr::include_graphics("Moravec.png")
```

【问题讨论】:

    标签: r markdown r-markdown bookdown


    【解决方案1】:

    您可以使用文本引用(请参阅Section 2.2.4 of the bookdown book)。

    (ref:moravec) look the citation doesn't work [@moravec1980obstacle]
    
    ```{r moravec, echo=FALSE, fig.cap="(ref:moravec)"}
    knitr::include_graphics("Moravec.png")
    ```
    

    【讨论】:

      【解决方案2】:

      latex 解决方案也有效,它在引用样式上具有far more control,但显然仅限于pdf 输出,例如\citep{Bradshaw2010}

      【讨论】:

        猜你喜欢
        • 2021-01-31
        • 2012-11-30
        • 2015-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多