R markdown link 编织为 pdf 时未格式化为蓝色

R markdown link is not formatted blue when knitted to pdf

出于某种原因,我的 R markdowns (rmd) 中没有 link 格式为蓝色。将下面的简单 rmd 编织成 pdf 会使文本颜色变为黑色。只有将鼠标悬停在它上面时,才会意识到它实际上是一个 link。编织成 html 会使 link 变成蓝色。我当然可以使用乳胶包装纸,但我想知道为什么会这样?

sessionInfo() R version 3.3.0 (2016-05-03) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 loaded via a namespace (and not attached): knitr_1.15

RStudio 1.0.44

---
title: "R Notebook"
output:
  pdf_document: default
  html_notebook: default
---

```{r, echo=F}
# tex / pandoc options for pdf creation
x <- Sys.getenv("PATH")
y <- paste(x, "E:\miktex\miktex\bin", sep=";")
Sys.setenv(PATH = y)
```

[link](www.rstudio.com)

urlcolor: blue 添加到 yaml。

---
title: "R Notebook"
output:
  pdf_document: default
  html_notebook: default
urlcolor: blue
---

```{r, echo=F}
# tex / pandoc options for pdf creation
x <- Sys.getenv("PATH")
y <- paste(x, "E:\miktex\miktex\bin", sep=";")
Sys.setenv(PATH = y)
```

[Link to R Studio](www.rstudio.com)

Bare urls will also be highlighted:

http://www.rstudio.com

详细说明@eipi10 的回答,并回答@Maarten Punt 评论中的问题,urlcolor 指定 URL link 引用的颜色在文档中。但是,您可能有 link 到文档中的其他部分,由 linkcolor 指定。所以你可以指定:

---
title: "R Notebook"
output:
  pdf_document: default
urlcolor: blue
linkcolor: red
---

## test links vs urls

* see [the relevant section](#test)



[link](http://www.rstudio.com)


```{r cars}
summary(cars)
```

\newpage

## Including Plots{#test}

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

红色是文档中的 link,而蓝色是 URL link。