How to change to another bibliography style in Bookdown

让人想犯罪 __ 提交于 2019-12-05 16:19:36
  • Download your .csl file from https://www.zotero.org/styles?q=nature and copy it to the root of your project.
  • Set in _output.yml citation_package: none
  • Add in all formats (gitbook, pdf_book, epub_book) in _output.yml the line pandoc_args: [ "--csl", "your-csl-file.csl" ]
  • Delete or comment out in index.Rmd the line biblio-style: apalike

See for the full procedure use csl-file for pdf-output in bookdown

You specify the bibtex style nature.bst, but that is not available on your system. Neither can I find it on CTAN. A search on CTAN gives two things:

So either use

 biblio-style: naturemag

or (prefered, see below) switch to biblatex using

bookdown::pdf_book:
  citation_package: biblatex

in _output.yml. In both cases you have to make sure that the required TeX packages are installed. This depends on the TeX distribution. In my case (TeXLive packaged for Debian) this meant

sudo apt-get install texlive-publishers texlive-bibtex-extra

For TeXLive proper or TinyTeX you can use on the command line:

tlmgr install nature
tlmgr install biblatex-nature

For TinyTeX you can also do this within R:

library(tinytex)
tlmgr_install('nature')
tlmgr_install('biblatex-nature')

See the maintenance section for more details.

Unfortunately only the bbilatex solution is compatible with the default citation commands produced by bookdown. One probably could change insert LaTeX commands for the citations, but that would make producing other formats more complicated. In addition, biblatex is "the way to go" for many bibliography questions in LaTeX ...

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