natbib seems to not work properly with pdf_book / rticles

China☆狼群 提交于 2019-12-24 10:57:07

问题


In my .Rmd file, I refer to position in .bib file as follows: "Let me cite an article: [@SampleTitle2016]"

When I 'knit the current', I would like to have .tex file where citations to articles are provided by \cite, \citep or \citet command.

I noticed that if I omit the line 'citation_package: natbib' in output params, citations are provided as a raw text:

However, If add mentioned line, .tex file looks better, but for some reason, bibliography is unable to properly display / (compile?) - I see "?" instead of proper citations:

My .Rmd looks as follows:

---
title: "Sample document"
abstract: "This is a sample abstract \\newline This is the second line of abstract \\par \\textbf{Keywords:} keywordA, keywordB"
author:
  - name: Mateusz Kędzior
    email: alice@example.com
    affiliation: Some Institute of Technology
    footnote: Corresponding Author
bibliography: bibliography_escaped.bib
output:
  bookdown::pdf_book:
    base_format: rticles::elsevier_article
    keep_tex: true
    citation_package: natbib
---

## Sample Text

Let me cite an article: [@SampleTitle2016].

Without natbib, in .tex file citep  command is not used in output .tex file.

An with natbib, it seems there's problem with bibliography compilation.

## References

My bibliography file looks as follows:

@article{SampleTitle2016,
    title = "This is sample title only \{\k{A}\} \{\L{}\}",
    journal = "Some journal",
    volume = "99",
    number = "",
    pages = "21 - 31",
    year = "2018",
    note = "This is fake",
    url = "http://ImustChangedThatLinkBecauseSOdoNotALLOWletmeG",
    author = "Mateusz K\k{e}dzior and \.{Z}\k{a}\'{c}\l{} \'{Z}\k{e}\'{n}",
    keywords = "keywordC",
    keywords = "Keyword D",
}

@article{OtherTitle2010,
    title = "{{This is different \k{A} title only}}",
    journal = "Some journal",
    volume = "150",
    number = "",
    pages = "21 - 31",
    year = "2020",
    note = "This is fake",
    url = "http://someLink/",
    author = "\.{Z}\k{a}\'{c}\l{} \'{Z}\k{e}\'{n}",
    keywords = "keyword\k{A}",
    keywords = "Keyword \'{Z}",
}

来源:https://stackoverflow.com/questions/42378269/natbib-seems-to-not-work-properly-with-pdf-book-rticles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!