2

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. Incorrect header

Minyi Han
  • 807
  • 1
  • 8
  • 15

1 Answers1

2

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

petzi
  • 1,430
  • 1
  • 17
  • 32
  • There is one line in _output.yml. ` pandoc_args: "--top-level-division=chapter" 1 and I revised is as ` pandoc_args: ["--top-level-`division=chapter", "--csl", "chinese-gb7714-2005-numeric.csl" ]` the citation in text is expected. However the section name `参考文献` `Reference` at the end of the book disappeared. – Minyi Han Jun 02 '18 at 09:47
  • Replace the content of 06-references.Rmd with `# References {-}` – petzi Jun 02 '18 at 09:54
  • Many thanks. I made it after following the https://stackoverflow.com/questions/48965247/use-csl-file-for-pdf-output-in-bookdown/49145699#49145699 – Minyi Han Jun 02 '18 at 09:57
  • today I found the header of Chapter reference was not correct. It should be "Reference" instead of the previous chapter's. – Minyi Han Jun 03 '18 at 02:18
  • I asked in another question. https://stackoverflow.com/questions/50663004/customize-or-remove-the-header-of-reference-after-specify-csl-on-bookdown – Minyi Han Jun 03 '18 at 03:25