Pandoc uses a Markdown format that supports automatic citations using keys from BibTeX files. Some examples for the format are:
Bl
To do this you can use reftex-citation
.
You have to enable RefTeX for the file you are editing which can be done via M-x reftex-mode
or by setting a file variable such as adding -*- mode: reftex; -*-
to the first line of the file.
You need to tell RefTeX where your bibliography file is. This can be done by adding the following to your .emacs (and editing the path according to your setup):
;; So that RefTeX finds my bibliography
(setq reftex-default-bibliography '("path/to/bibfile.bib"))
Note that reftex-default-bibliography
is a list, so you can add several paths to it.
If you use different bibliographies for different files it might be preferable to tell RefTeX of the bibliography from each file. I am afraid I only know of an ugly way to do this. The idea is that since RefTeX can extract the correct bibliography from LaTeX macros you can embed a LaTeX macro in a comment. Thus, you can add such a comment along with the specification of bibliography to Pandoc:
bibliography::bibliography_name.bib
To get reftex-citation
to insert in the format used by Pandoc you have to customize reftex-cite-format such as inserting the following into your .emacs:
(eval-after-load 'reftex-vars
'(progn
(setq reftex-cite-format '((?\C-m . "[@%l]")))))
You may wan to include other formats too. For instructions on how to do this see https://tex.stackexchange.com/a/31992/5701. Note that this setting is global so that if you also use RefTeX for LaTeX it will also be affected.
To insert a citation either do M-x reftex-citation
or C-c [
then press Enter and you are allowed to insert a search term for searching in your bibliography. RefTeX will then insert the key of the bibliography item you selected in Pandoc format.