song.xiao
song.xiao

Reputation: 179

In R Markdown, how do I create citations to references with a hyperlink?

Now I have a RMarkdown file, when the citation for the reference is clicked, I want the reader to be navigated to the corresponding reference in the bibliography.

---
title: "My Title"
author: "my name"
date: "2020/2/6"
output: 
  pdf_document:
    keep_tex: true
header-includes:
    - \hypersetup{colorlinks = false,pdfborder={1 1 1}}


bibliography: bibfile.bib
---

[Stack Overflow](https://stackoverflow.com/)

This is my reference[@Breiman2001].

enter image description here

I want the effect could be like this:

enter image description here

this is the .bib file:

@article{Breiman2001,
  title={Random Forests},
  author={Breiman, Leo},
  journal={Machine Learning},
  volume={45},
  number={1},
  pages={5-32},
  year={2001},
}

Upvotes: 3

Views: 1633

Answers (1)

giocomai
giocomai

Reputation: 3518

You should be able to fix this by adding link-citations: true in your YAML.

See this other question on SO for more details: Rmarkdown removes citation hyperlink

Upvotes: 3

Related Questions