Offray Offray - 2 months ago 13
Markdown Question

Exporting all yaml bibliographic in a pdf file using pandoc

I'm using Leo, yaml and pandoc to create a pdf. For that, my workflow is something like this:


  1. I collected all relevant items as a zotero collection

  2. I exported all of them as CSL JSON and converted it to yaml using biblio2yaml

  3. I created a Leo outline with markdown nodes and a yaml node containing all the info for I want to write and all the collected bibliography items and made a small script to traverse the outline and export the things as I want.

  4. Finally over the output file I run:

    pandoc --filter pandoc-citeproc output.markdown -o output.pdf



and is working pretty fine. The thing is that I would like to tell pandoc to include all the bibliography items, no matter if they are referenced with
[@reference]
inside the markdown text or are just collected in the embeded yaml block for bibliography. Is this possible?, if not, there is some way to script pandoc to do something like that?

PS: I used the [-@reference] trick inside the pandoc's markdown, for trying to put non explicit references of the bibliography in the exported but then I get a year in parenthesis in the exported pdf, as one would expect, so that's not the way to go.

Answer

The README1 of pandoc gives the solution. You need to define a dummy nocite metadata field and put the citations there:

# References

The bibliography will be inserted after this header.  Note that
the `unnumbered` class will be added to this header, so that the
section will not be numbered.

If you want to include items in the bibliography without actually
citing them in the body text, you can define a dummy `nocite` metadata
field and put the citations there:

---
nocite: |
  @item1, @item2
...

@item3

In this example, the document will contain a citation for `item3`
only, but the bibliography will contain entries for `item1`, `item2`, and
`item3`.
Comments