问题
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