Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

citation-package: biblatex not working in R bookdown

EDIT: After some investigation, this question is really about the following option in the output yml:

citation-package: biblatex

Without this option, bookdown is using the default citeproc and it's not clear how to modify the number of authors. However, when this option is used, the referencing is not working anymore and my document contains only the refnames in bold instead of inline citations. So I really need to know why the citation-package: biblatex is not working

===== original question below

I can't get bookdown to honour my maxcitename=2 settings. I have tried using this output yml

output: 
  bookdown::pdf_book:
    includes:
      in_header: preamble.tex
    keep_tex: yes
    toc_depth: 3
    toc_appendix: yes

with this line in the preamble.tex file:

\usepackage[backend=bibtex, maxcitenames=2, style=authoryear]{biblatex}

I have also tried using this output yml:

bibliography: [likertimputebiblio.bib, packages.bib]
biblatexoptions: [maxcitenames=2]
csl: harvard-university-of-wolverhampton.csl
link-citations: true
nocite: | 
  @R-bookdown

and I have also tried this output yml:

site: bookdown::bookdown_site
documentclass: book
header-includes:
  - \usepackage[backend=bibtex, maxcitenames=2, style=authoryear]{biblatex}

but nothing seems to work.

Please help. Thanks.

like image 607
julianhatwell Avatar asked Oct 17 '22 10:10

julianhatwell


1 Answers

The solution to this problem was found after much perseverence!

When setting the output yml, indented under output: etc...

citation_package: biblatex

... the in line references were failing to link to the .bib file and so the refnames were just showing up in bold and failing to make any inline citations.

The expected solution should be to use the additional option:

biblatexoptions: [backend=bibtex, maxcitenames=2]

(maxcitenames=2 is the main reason I want to use biblatex) but this was failing with the error "option backend not recognized." Finally the solution was to modify the default template in the directory

C:\Program Files\R-3.4.0\library\rmarkdown\rmd\latex

at line 100, from

\usepackage$if(biblio-style)$[style=$biblio-style$]$endif${biblatex}

to

\usepackage$if(biblio-style)$[backend=bibtex, style=$biblio-style$]$endif${biblatex}

I would like to suggest to the package author that this is a bug that needs fixing, because backend=bibtex is a valid option and should have been passed through

like image 144
julianhatwell Avatar answered Oct 21 '22 05:10

julianhatwell