5

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.

julianhatwell
  • 1,074
  • 1
  • 8
  • 17
  • Please describe exactly how it is breaking? Is this just a case of this: https://tex.stackexchange.com/questions/114442/biblatex-is-ignoring-maxcitenames ? We can't tell without more info. – Dason Jun 19 '17 at 15:05
  • Alternatively - what does the generated .tex file look like? Does it include your header? If so then this probably isn't a bookdown issue. – Dason Jun 19 '17 at 15:08
  • Hi, it seems to be a similar problem as the one described. However, it think it is a bookdown issue because this line – julianhatwell Jun 19 '17 at 16:12
  • Hi, similar problem but not quite the same. maxcitenames is using the default 3 for the autheryear format. If I use the line in the preamble.tex file then it appears in the main.tex file as expected. However, it if used in output yml instead, it does not get pulled in. I do think it is a bookdown issue because I see the names rendered incorrectly in the main.tex file, as it they've already been partially rocessed somehow. Also this line \usepackage[backend=bibtex, maxcitenames=2, style=authoryear]{biblatex} works perfectly well in an R Sweave file (.Rnw) compiled by knitr and – julianhatwell Jun 19 '17 at 16:24
  • Furthermore, I have now discovered that output yml containing citation_package: biblatex (at the same indent level as includes) actually breaks all the in text citations. They just appear with the bibref in bold type. – julianhatwell Jun 19 '17 at 17:02
  • Also the option biblatexoptions: [maxcitenames=2] will be inculded as \ExecuteBiblatexOptions{maxcitenames=2} in the main.tex file but only if the citation_package: biblatex is also used (but that breaks everything, so it's no use). – julianhatwell Jun 19 '17 at 17:02
  • So I'm coming to the conclusion that biblatex is not used by default which is why the preamble.tex solution doesn't do anything. When I switch to using biblatex with the citation_package: option in output.yml, that is breaking the referencing - which is an even bigger problem. – julianhatwell Jun 19 '17 at 17:20

1 Answers1

3

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

julianhatwell
  • 1,074
  • 1
  • 8
  • 17