Search code examples
pdflatexmarkdownpandocpandoc-citeproc

Pandoc bibliography : why is nocite not working?


I am trying to render a markdown document with Pandoc and leverage its bibliography capabilities. My references are listed in a main.bib file, and citation rendering works flawlessly with --bibliography=main.bib --citeproc and the cited references appear in my #refs div.

However, I'd like all my references to by listed in the #refs div, rather that only those which are cited.

According to Pandoc's user manual, adding the following to the YAML block should do the trick :

nocite: |
  @*

However, it doesn't work for me. Neither does -M nocite='@*' in the command. Any clue about that ?

Here is a minimal reproducible example (with pandoc 2.18) :

main.md :

---
title: "Pandoc nocite not working reproduction"
author: "ombrelin"
date: "2022-07-30"
titlepage: false
toc-own-page: true
bibliography: main.bib
book: true
tof: true
lof: true
...

# Introduction

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

# References

::: {#refs}
:::

``main.bib` :

@www{extreme_programming,
    author = {Don Wells},
    title = {Extreme Programming},
    date = {1999},
    url = {http://www.extremeprogramming.org/when.html},
}

and compile command :

pandoc \
    main.md -f markdown \
    --top-level-division=chapter \
    --citeproc \
    --bibliography=main.bib \
    -V fontsize=12pt \
    --pdf-engine=xelatex \
    --toc \
    -M nocite='@*' \
    -o "main.pdf"

Solution

  • Based on your minimal reproducible example, I could verify your problem.
    What did the trick for me, was adding a metadata-file metadata.yaml with the following content (based on the documentation):

    ---
    nocite: |
      @*
    ...
    

    ... and added it to the compile command:

    pandoc main.md -f markdown --top-level-division=chapter --citeproc --bibliography=main.bib -V fontsize=12pt --pdf-engine=xelatex --toc --metadata-file=metadata.yaml -o "main.pdf"
    

    Which adds the entry to the references section enter image description here