Rmarkdown删除引用超链接 [英] Rmarkdown removes citation hyperlink
问题描述
使用Rmarkdown构建包含引文的pdf时,默认情况下会删除引文的超链接.
when using Rmarkdown to build a pdf with citations included, it removes the hyperlinks of the citations by default.
看一下生成的乳胶文件,我可以在序言中看到\ usepackage {hyperref},但引文如下:
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)
因此它会在pdf中产生非动态引文.
Thus it produces a non-dynamic citation in pdf.
我期望的乳胶输出为:\ citet {sharpe},它将以pdf格式产生超链接引用.
The latex output that I would expect is: \citet{sharpe}, which produces hyperlinked citation in pdf.
有什么主意为什么会这样写出我的bibtex输入以及如何使其超链接?
Any ideas why it writes out my bibtex inputs like this and how I can make it hyperlinked?
推荐答案
默认情况下,pandoc将进行引文的呈现.我看到了两种选择.
By default pandoc will do the rendering of the citations. I see two alternatives.
- 在Rmd中使用
\citet{sharpe}
而不是@sharpe
.缺点:您只能将Rmd渲染为pdf. - 使用
--natbib
参数.缺点:将其呈现为pdf时,您需要执行额外的bibtex
步骤.
- Use
\citet{sharpe}
in the Rmd instead of@sharpe
. Downside: you can only render the Rmd into pdf. - Use the
--natbib
argument. Downside: You need an extrabibtex
step when rendering into pdf.
更新:您还可以在YAML中提供选项link-citations: true
(自pandoc v1.16
起),并保留pandoc语法以进行引用.
Update: You can also provide the option link-citations: true
in your YAML (since pandoc v1.16
) and keep the pandoc syntax for citations.
这篇关于Rmarkdown删除引用超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!