knitr 指的是带有 link 的数字

knitr refer to a figures with a link

当使用knitr/Rmarkdown时,一个link如何在文件中显示?示例图 10 在第 10 页,我想 link 从第四页开始。

像这样: "Take a look at figure 10"图10应该有一个link可以点击。

这可能是重复的。无论如何,您的 .rmd 文件可能看起来或多或少像这样:

---
title: "Clickable Reference to Figure"
output:
  pdf_document:
    fig_caption: yes
---

Here's a figure:

```{r fig, echo=FALSE, fig.width=4,fig.height=3, fig.cap="\label{fig:myfig}plotting example"}
plot(runif(100, 0.0, 1.0),type="l")
```

Take a look at Figure \ref{fig:myfig} for an example of plotting in R.

无需指定页码或文档中图片的准确位置。 \ref{} 在输出中生成的 link 指向该数字。