pzhaonet / bookdownplus

The easiest way to use R package bookdown for writing varied types of books and documents
MIT License
253 stars 31 forks source link

How to change biblio-style with other csl style files? #21

Closed winterwang closed 6 years ago

winterwang commented 6 years ago

Hi, in regular rmarkdown environment, we can specify csl: the-lancet.csl in the header of the .Rmd file. like this:

---
title: "Sample Document"
output: html_document
bibliography: bibliography.bib
csl: biomed-central.csl
---

How to tweak the similar things in your package?

pzhaonet commented 6 years ago

Hi. bookdownplus helps users to create bookdown templates. When a template is already created, you can change the .Rmd files as you like, and it has nothing to do with bookdownplus any more.

winterwang commented 6 years ago

I mean, when I am using the article template in your package. I wanted to change the style of bibliography into other journals like lancet or anything. I realised that there is a line: biblio-style: chicago in the index.Rmd file.

Any suggestion about how can we specify other style of bibliography?

Thanks

pzhaonet commented 6 years ago

https://github.com/rstudio/bookdown/issues/354

winterwang commented 6 years ago

Thanks for the link. But I still have the problem in changing the bibliography style. I have tried that option and please have a look at my code in the file index.Rmd below:

--- 
title: "My Manuscript"
author: "Student anonymous"
date: ""
Abstract: "blablabla" 
#acknowledgements: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
output:
  bookdown::pdf_book:
    template: tex/template_article.tex
    keep_tex: yes
    citation_package: natbib
#    latex_engine: xelatex
    toc_depth: 3
    toc_unnumbered: no
    toc_appendix: yes
    quote_footer: ["\\begin{flushright}", "\\end{flushright}"]
    pandoc_args: [ "--csl", "nature.csl" ]
bibliography: [bib/bib.bib]
#biblio-style: 
link-citations: yes
colorlinks: no  
# toc: no
lot: no
lof: no
site: bookdown::bookdown_site
---

And there are no error reports during the building, but the file output gave the exact same when we use biblio-style: apalike. 2017-11-02_192708 2017-11-02_192649

While the correct format should look like this: 2017-11-02_193115

pzhaonet commented 6 years ago

Sorry for the misunderstanding. Please specify the path of your csl file in the YAML of index.Rmd, and you will succeed. For example, I copied nature.csl to to my working directory, and specified it like:

biblio-style: nature

Then I got in the pdf output:

20171103101053

winterwang commented 6 years ago

Problem solved.

Nice package. Thanks a lot