How to cite using bibtex in blogdown?

▼魔方 西西 提交于 2019-12-10 17:51:23

问题


I would like to use citations on a page of my static website created with the R package blogdown. Based on the book written about blogdown (https://bookdown.org/yihui/blogdown/#) this seems to be possible. However, I do not not know exactly how to set this up. I know how to do this in a rmarkdown file and in a bookdown file, but not in the context of a website created with blogdown.

First, I created a new post using the new_post() function in the blogdown package. Second, I added bibliography: [references.bib] and @R-base to the post:

---
title: publications
author: ~
date: '2017-09-25'
slug: publications
categories: []
tags: []
header:
  caption: ''
  image: ''

bibliography: [references.bib]

---

@R-base

where the file references.bib is located in the same folder as the post containing

@Manual{R-base,
  title = {R: A Language and Environment for Statistical
    Computing},
  author = {{R Core Team}},
  organization = {R Foundation for Statistical Computing},
  address = {Vienna, Austria},
  year = {2016},
  url = {https://www.R-project.org/},
}

Thank you in advance for your help!

EDIT: I now created a Github repo with as theme academic: repo. To keep it as simple as possible, I only added the publications post (see content/post) and the file references.bib to the example site of the academic theme. These two files exactly match the publications post and references.bib file that were shown above.


回答1:


I tried your website on github. The problem is that you used a md file for your bibliography, but if you want bookdown to process it, you need to save it as a Rmd file.
By the way, I guess that what you want is not the citations like (R core team, 2016) but directly the list of publications like:

R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.

Thus, you should use this kind of header saved in a Rmd file:

---
title: publicationsRmd
author: Me
date: '2017-09-26'
slug: publicationsrmd
categories: ["biblio"]
tags: ["tag"]
bibliography: [references.bib]
nocite: | 
  @R-base
---



回答2:


.md files go through the 'blackfriday' parser which doesn't handle citations using @.

.Rmd files go through rmarkdown and pandoc and therefore will be able to understand the @ sign.

Renaming the ext should do. Good luck!



来源:https://stackoverflow.com/questions/46414520/how-to-cite-using-bibtex-in-blogdown

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