Skip to content

citeproc settings in YAML metadata block: Problems when using pandoc-zotxt.lua filter #2294

Closed
@njbart

Description

@njbart

Bug description

This report describes an issue with obtaining bibliographic data directly from Zotero, bypassing the need for exporting .bib, .json, or .yaml bibliographic data, by using the Zotero add-on zotxt and the associated pandoc filter pandoc-zotxt.lua.

Using Rmarkdown, it is possible to knit/render files such as the following from within RStudio (provided Zotero is running, and an entry @bard:2015introduction does exist):

---
output:
  html_document: 
    pandoc_args:
      - '--lua-filter'
      - pandoc-zotxt.lua
      - '--citeproc'
---

Blah blah [@bard:2015introduction, 67].

Result:

Blah blah (Bard 2015, 67).

Bard, Kathryn A. 2015. An Introduction to the Archaeology of Ancient Egypt. 2nd ed. Hoboken, NJ: Wiley-Blackwell.

Using quarto from the command line, with this file (test.qmd)

---
format: html
---

Blah blah [@bard:2015introduction, 67].

and the command

quarto render test.qmd -L /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua -C

produces the exact same expected result.

(Note that I had to provide the full path to the filter here, but that seems to be a different issue.)

For qmd from within RStudio, one would expect to be able to achieve the same with appropriate settings in the YAML metadata block; however, this does not seem to be possible, as using pandoc-args (or pandoc_args) has no effect, and does not seem to be supported anyway.

Example:

---
format:
  html: 
    pandoc-args:
      - '--lua-filter'
      - /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua
      - '--citeproc'
---

Blah blah [@bard:2015introduction, 67].

Result:

Blah blah [@bard:2015introduction, 67].

(i.e., citation not resolved)

Including filters and citeproc: TRUE in the header has no effect either:

---
filters:
  - /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua
citeproc: TRUE
format: html
---

Blah blah [@bard:2015introduction, 67].

Result:

Blah blah [@bard:2015introduction, 67].

(i.e., citation not resolved)

What does work is including the instruction to use a bibliography file (dummy.json) which includes only one (dummy) entry, different from @bard:2015introduction. This seems sufficient to trigger the activation of citeproc.

---
filters:
  - /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua
format: html
bibliography: dummy.json
---

Blah blah [@bard:2015introduction, 67].

Result: as expected (note that not even citeproc: TRUE is required here).

Possible solutions:

  1. Allow the use of citeproc as a (pseudo-) filter (note that the the order of filters matters)

    filters:
      - /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua
      - citeproc
    
  2. Include support for using pandoc-args (or pandoc_args) in a YAML metadata block.

  3. Make the following work:

    filters:
      - /Users/nb/.local/share/pandoc/filters/pandoc-zotxt.lua
    citeproc: TRUE
    

    A problem I see here, though, is that in this particular case pandoc-zotxt.lua has to be run before citeproc, but there might be other filters that have to be run after citeproc, so the option to force a specific order of filters (and pseudo-filters) which would be possible with 1. and 2. might be best.


RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6_8) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

quarto -v
1.1.179

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions