-
-
Save robertodr/2dae2d4fbbdd5ba4018702c3a58ba908 to your computer and use it in GitHub Desktop.
Insert markdown (pandoc-citeproc) formatted citations using RefTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; reftex in markdown mode | |
;; if this isn't already set in your .emacs | |
(setq reftex-default-bibliography '("/path/to/library.bib")) | |
;; define markdown citation formats | |
(defvar markdown-cite-format) | |
(setq markdown-cite-format | |
'( | |
(?\C-m . "[@%l]") | |
(?p . "[@%l]") | |
(?t . "@%l") | |
) | |
) | |
;; wrap reftex-citation with local variables for markdown format | |
(defun markdown-reftex-citation () | |
(interactive) | |
(let ((reftex-cite-format markdown-cite-format) | |
(reftex-cite-key-separator "; @")) | |
(reftex-citation))) | |
;; bind modified reftex-citation to C-c[, without enabling reftex-mode | |
;; https://www.gnu.org/software/auctex/manual/reftex/Citations-Outside-LaTeX.html#SEC31 | |
(add-hook | |
'markdown-mode-hook | |
(lambda () | |
(define-key markdown-mode-map "\C-c[" 'markdown-reftex-citation))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment