Search code examples
luar-markdownpandoc

Error running filter multiple-bibliographies.lua


I am trying to run a Lua filter for multiple bibliographies to create a separate list of references for each chapter of my thesis.

This is my YAML header:

title: ''
output: 
  pdf_document:
        latex_engine: pdflatex
        number_sections: TRUE
        pandoc_args: --lua-filter=multiple-bibliographies.lua
always_allow_html: true
geometry: "left = 4cm, right = 2cm, top = 2cm, bottom = 2cm"
fontsize: 11pt
header-includes:
  - \usepackage{float}
  - \usepackage{sectsty}
  - \usepackage{paralist}
  - \usepackage{setspace}\spacing{1.5}
  - \usepackage{fancyhdr}
  - \usepackage{lastpage}
  - \usepackage{dcolumn}
  - \usepackage{natbib}
  - \usepackage[nottoc, numbib]{tocbibind}
  - \usepackage{ragged2e}
  - \usepackage{pdflscape}
  - \usepackage{textgreek}
  - \usepackage{graphicx}
classoption: twoside
bibliography_Intro: Intro.bib
bibliopgraphy_ch1: Endozoochory.bib
bibliopgraphy_ch2: Vysevovy_clanek.bib
bibliopgraphy_ch3: Seeds.bib
bibliopgraphy_ch4: Landscape.bib
citation_package: biblatex
csl: journal-of-ecology.csl

At the end of each chapter I have:

## References
::: {#refs_Intro}
:::

I am not very experienced with pandoc and LaTeX so this might be a simple error on my side. However, when I try to knit the document, it gives me an error:

Error running filter multiple-bibliographies.lua: PandocFilterError
"pandoc" "Could not find executable pandoc" stack traceback:
  multiple-bibliographies.lua:50: in upvalue 'run_citeproc'
  multiple-bibliographies.lua:82: in function
<multiple-bibliographies.lua:68> Error: pandoc document conversion
failed with error 83

I've been struggling with the bibliographies for several days and I think this is the last option but I am open to other possibilities in RMarkdown.

I am running this on Ubuntu 20, pandoc version 2.19.2, rmarkdown_2.18, R version 4.2.2


Solution

  • The problem is that the filter tries to call pandoc, but cannot find it, as it does not check the environment variables set by RStudio. This is fixed in the updated version of this filter, multibib, which uses some newer pandoc features to work around this. The new version can also be installed as a Quarto extension.

    Note, however, the slightly changed syntax used in multibib, as everything must now be nested below the bibliography key:

    ---
    bibliography:
      Intro: Intro.bib
      ch1: Endozoochory.bib
      ch2: Vysevovy_clanek.bib
      ch3: Seeds.bib
      ch4: Landscape.bib
    ---
    

    Please also try the section-bibliographies filter, which might be a better fit for your use-case.