Bibliographies 以及 Citations


定义一个 Bibliography

Pandoc 可以自动生成不同样式的引用。为了使用这一特性,你需要通过在 YAML metadata 部分中的 bibliography 定义里面制定一个 bibliography 文件。例如:

  1. ---
  2. title: "Sample Document"
  3. output: pdf_document
  4. bibliography: bibliography.bib
  5. ---

如果你想要包含多个 bibliography 文件,那么你也可以如下定义:

  1. ---
  2. bibliography: [ bibliography1.bib, bibliography2.bib ]
  3. ---

bibliography 文件可以有以下类型:

Format File extension
BibLaTeX .bib
BibTeX .bibtex
Copac .copac
CSL JSON .json
CSL YAML .yaml
EndNote .enl
EndNote XML .xml
ISI .wos
MEDLINE .medline
MODS .mods
RIS .ris


你还可以直接在 YAML metadata 里使用 reference 项。这个应该包含了一数组的 YAML-encoded 引用,例如:

  1. ---
  2. references:
  3. - id: fenner2012a
  4. title: One-click science marketing
  5. author:
  6. - family: Fenner
  7. given: Martin
  8. container-title: Nature Materials
  9. volume: 11
  10. URL: ''
  11. DOI: 10.1038/nmat3283
  12. issue: 4
  13. publisher: Nature Publishing Group
  14. page: 261-263
  15. type: article-journal
  16. issued:
  17. year: 2012
  18. month: 3
  19. ---

Bibliography 放置

Bibliographies 将会被放在文档的最后面。通常情况下爱,你会想要在文档的最后添上一个合适的标题:

  1. last paragraph...
  2. # References

Bibliography 将会被插入在这个标题之后。


Citation 语法

Citations go inside square brackets and are separated by semicolons. Each citation must have a key, composed of ‘@’ + the citation identifier from the database, and may optionally have a prefix, a locator, and a suffix. Here are some examples:

  1. Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
  2. Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
  3. Blah blah [@smith04; @doe99].

A minus sign (-) before the @ will suppress mention of the author in the citation. This can be useful when the author is already mentioned in the text:

  1. Smith says blah [-@smith04].

You can also write an in-text citation, as follows:

  1. @smith04 says blah.
  2. @smith04 [p. 33] says blah.

Unused References (nocite)

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:

  1. ---
  2. nocite: |
  3. @item1, @item2
  4. ...
  5. @item3

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

Citation Styles

By default, pandoc will use a Chicago author-date format for citations and references. To use another style, you will need to specify a CSL 1.0 style file in the csl metadata field. For example:

  1. ---
  2. title: "Sample Document"
  3. output: html_document
  4. bibliography: bibliography.bib
  5. csl: biomed-central.csl
  6. ---

A primer on creating and modifying CSL styles can be found here. A repository of CSL styles can be found here. See also for easy browsing.

Citations for PDF Output

By default, citations are generated by the utility pandoc-citeproc, and it works for all output formats. When the output is LaTeX/PDF, you can also use LaTeX packages (e.g. natbib) to generate citations; see PDF documents for details.