Pandoc citations without appending the references bibliography
Asked Answered
M

1

10

Main Question: Is there a way to flag Pandoc to turn off appending the bibliography but still have it insert the correct inline citations?

I am writing a Markdown / Knitr document that has a main file (article.Rmd) and several "child" files that are included in the main file using Knitr's "child=" chunk option.

The child files are basically sections of the main article file, just separated for easier editing and management. Throughout these child section files, I use the citations in the Markdown text (e.g. "@author_title_1999") to cite various papers. The main file and each child file has a YAML header that provides the BibTex file location, e.g.:

---
bibliography: mybibfile.bib  
...

(Including this YAML entry more than once is not a problem; see the readme on metadata-blocks.)

When I compile the entire document using Knitr, a big Markdown document is created. I then use Pandoc with the --filter pandoc-citeproc option to manage the citations. Pandoc inserts nice citations and appends a list of the cited papers as references/bibliography. Cool.

As I write and edit the individual child sections, I use the same citation compiling which produces the correct inline citations, but unfortunately also appends the references at the end, even though it's just a section of the larger document. I would like to compile these small child sections with inline citations, but without the bibliography at the end.

Manly answered 17/10, 2014 at 19:2 Comment(1)
It looks like the required feature has now been implemented in pandoc-citeproc. See my updated answer.Etamine
E
12

I think this is possible with the suppress-bibliography metadata field first introduced in pandoc-citeproc 0.7 (released in May 2015). From the current pandoc-citeproc man page:

pandoc-citeproc will look for the following metadata fields in the input:
...
suppress-bibliography : If this has a true value, the bibliography will be left off. Otherwise a bibliography will be inserted into each Div element with id refs. If there is no such Div, one will be created at the end of the document.

(as a workaround, you can also quite easily create a custom CSL style that doesn't produce a bibliography, by deleting the cs:bibliography child element of the style. See http://docs.citationstyles.org/en/stable/specification.html#child-elements-of-cs-style.)

Etamine answered 18/10, 2014 at 17:28 Comment(1)
Thank Rintze. The suppress-bibliography option wasn't working for some reason, but the csl workaround you suggest did for me.Gudrin

© 2022 - 2024 — McMap. All rights reserved.