如何在bookdown上指定csl书目风格

时间:2018-06-02 01:55:13

标签: r markdown bookdown

如何在bookdown中文Bookdown Chinese example上指定csl参考书目样式,例如zotero one CSL

我将csl文件下载到工作目录,并在index.Rmd YAML标头中指定为

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

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

但Rstudio向我发起了承诺:

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

Exited with status 1.

当我把它改成

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

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

我可以构建这本书,但是参考列表样式不是CSL期望的样式。

所有YAML标题

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

更新

今天我发现章节标题的标题不正确。它应该是“参考”而不是前一章。 Incorrect header

1 个答案:

答案 0 :(得分:1)

你可能错过了两行:

  
      
  • 在_output.yml citation_package: none
  • 中设置   
  • 在_output.yml中添加所有格式(gitbook,pdf_book,epub_book)行pandoc_args: [ "--csl", "chinese-gb7714-2005-numeric.csl" ]
  •   

请参阅use csl-file for pdf-output in bookdown

的完整程序