7
votes

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.

1
It looks like the required feature has now been implemented in pandoc-citeproc. See my updated answer.Rintze Zelle

1 Answers

8
votes

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.)