I'm trying to get my publications into R-Markdown, specifically by using the rticles
package, but I'm running into problems with citations.
The goal is to get the natbib option running, such that citations are not "hardcoded" by pandoc.
I am familiar with the following topic on this website and references therein, but this does not provide a solution: natbib-seems-to-not-work-properly-with-pdf-book-rticles
Whenever I 'knit' the article while using the natbib
option my references remain undefined.
The only solution I was able to find was through the keep_tex: true
option and adding the \bibliography
command manually after compilation.
I can not imagine that this is really required to make the citations functional.
What I've tried, and the best I could come up with is the following modification of the template provided by rticles
is posted below.
The only way I found to get it running is actually open the generated .tex
file and before the \end{document}
add the line \bibliography{mybibfile}
, which can not be as intended.
Can anyone reproduce my issue and am I simply missing something, or is the issue more on the package side?
---
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}
==========
with the following 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.}"
}