我正在尝试将出版物发布到R-Markdown中,特别是使用rticles
软件包,但是我遇到了引用方面的问题。
目的是使natbib选项运行,以使pandoc不会对引用进行“硬编码”。
我熟悉此网站上的以下主题及其参考,但这不是提供解决方案的方法: natbib-seems-to-not-work-properly-with-pdf-book-rticles
每当我使用natbib
选项时“编织”文章时,我的引用就保持未定义状态。
我唯一能找到的解决方案是通过keep_tex: true
选项,并在编译后手动添加\bibliography
命令。
我无法想象这确实是使引用发挥作用所必需的。
我尝试过的,最能想到的是对rticles
提供的模板的以下修改。
我发现要使其运行的唯一方法实际上是打开生成的.tex
文件,并在\end{document}
之前添加行\bibliography{mybibfile}
,这可能不是预期的。
任何人都可以重现我的问题,而我只是错过了什么,还是问题更多地在包装方面?
---
title: Short Paper
author:
- name: Alice Anonymous
email: alice@example.com
affiliation: Some Institute of Technology
footnote: Corresponding Author
address:
- code: Some Institute of Technology
address: Department, Street, City, State, Zip
journal: "An awesome journal"
date: "`r Sys.Date()`"
bibliography: mybibfile.bib
output:
bookdown::pdf_book:
citation_package: natbib
base_format: rticles::elsevier_article
number_sections: yes
keep_tex: true
---
Bibliography styles
===================
Here are two sample references: @Feynman1963118 [@Dirac1953888].
References {#references .unnumbered}
==========
带有以下mybibfile.bib
:
@article{Dirac1953888,
title = "The lorentz transformation and absolute time",
journal = "Physica ",
volume = "19",
number = "1-–12",
pages = "888--896",
year = "1953",
doi = "10.1016/S0031-8914(53)80099-6",
author = "P.A.M. Dirac"
}
@article{Feynman1963118,
title = "The theory of a general quantum system interacting with a linear dissipative system",
journal = "Annals of Physics ",
volume = "24",
pages = "118--173",
year = "1963",
doi = "10.1016/0003-4916(63)90068-X",
author = "R.P Feynman and F.L {Vernon Jr.}"
}
答案 0 :(得分:0)
由于未从RMarkdown通过LaTeX编织PDF时未指定书目样式,因此有时未出现参考部分。根据{{3}},您可以像这样在YAML部分设置biblio-style
:
bibliography: mybibfile.bib
biblio-style: apa #whatever style you want