how to specify a csl bibliography style on bookdown

别等时光非礼了梦想. 提交于 2019-12-13 18:11:55

问题


how to specify a csl bibliography style on bookdown Chinese Bookdown Chinese example, for example a zotero one CSL.

I downloaded the csl file to the working directory, and specify it in index.Rmd YAML header as

bibliography: book.bib    
biblio-style: chinese-gb7714-2005-numeric

or

bibliography: book.bib
biblio-style: chinese-gb7714-2005-numeric.csl

but Rstudio promted me:

Error: Failed to build the bibliography via bibtex
Please delete bookdown.Rmd after you finish debugging the error.
Execution halted

Exited with status 1.

when I changed it to

bibliography: book.bib
csl: chinese-gb7714-2005-numeric

or

bibliography: book.bib
csl: chinese-gb7714-2005-numeric.csl

I can build the book, however the reference list style was not the one the CSL expected.

All the YAML header

--- 
title: "题名"
author: "姓名"
date: "`r Sys.Date()`"
bibliography: book.bib
description: "矮脚黄"
documentclass: ctexbook
geometry:
- b5paper
- tmargin=2.5cm
- bmargin=2.5cm
- lmargin=3.5cm
- rmargin=2.5cm
github-repo: yihui/bookdown-chinese
indent: 2m
link-citations: yes
lof: no
lot: no
colorlinks: yes
site: bookdown::bookdown_site
biblio-style: unsrt
whitespace: none
---

updated:

today I found the header of Chapter reference was not correct. It should be "Reference" instead of the previous chapter's.


回答1:


You probably missed two lines:

  • Set in _output.yml citation_package: none
  • Add in all formats (gitbook, pdf_book, epub_book) in _output.yml the line pandoc_args: [ "--csl", "chinese-gb7714-2005-numeric.csl" ]

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



来源:https://stackoverflow.com/questions/50652853/how-to-specify-a-csl-bibliography-style-on-bookdown

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