Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

r - Rmarkdown removes citation hyperlink

when using Rmarkdown to build a pdf with citations included, it removes the hyperlinks of the citations by default.

Looking at the latex file produced, I can see usepackage{hyperref} in the pre-amble, but the citations look as follows:

rmd input:    @sharpe
latex output:  sharpe (1999)

Thus it produces a non-dynamic citation in pdf.

The latex output that I would expect is: citet{sharpe}, which produces hyperlinked citation in pdf.

Any ideas why it writes out my bibtex inputs like this and how I can make it hyperlinked?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

By default pandoc will do the rendering of the citations. I see two alternatives.

  1. Use citet{sharpe} in the Rmd instead of @sharpe. Downside: you can only render the Rmd into pdf.
  2. Use the --natbib argument. Downside: You need an extra bibtex step when rendering into pdf.

Update: You can also provide the option link-citations: true in your YAML (since pandoc v1.16) and keep the pandoc syntax for citations.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...