Myles | 18 Jun 2012 16:40
Picon

Feature request: RefTeX, access the "file" BibTeX field for use with org-mode

Hi,

Would somebody please consider changing (at least) reftex-format-citation to
allow access to the "file = {}" field in a BibTeX file?

This would be useful for improving co-usage of two very apps: Zotero and emacs
org-mode, towards the goal of bibliography management.

Currently it is possible to export a bib file and attached (pdf) files from
Zotero, with the "file" field including a relative path to the actual (pdf) file:

  file = {npont.pdf:files/5/npont.pdf:application/pdf}

This could be used for inserting a heading and link to the file in an org-mode
document, containing notes on a collection of papers:

(reftex-set-cite-format
	  '((?h . "** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%z][%l]]")))
((unload-feature 'reftex-cite )

I think this could be as easy as changing reftex-format-citation to include:

 ;; zotero path to the (pdf) file
 ((= l ?z) (reftex-get-bib-field "file" entry))

...plus extracting the path from the field.

An almost identical request, from a slightly different angle, was made in
September 2011 but it appears to have fizzled out inconclusively:

(Continue reading)

Myles | 19 Jun 2012 15:01
Picon

[PATCH] Re: Feature request: RefTeX, access the "file" BibTeX field for use with org-mode

Allow access to the 'file' field, and split it to give the relative path (for
zotero).

diff --git a/lisp/reftex-cite.el b/lisp/reftex-cite.el
index e1d2e92..f6adbcd 100644
--- a/lisp/reftex-cite.el
+++ b/lisp/reftex-cite.el
 <at>  <at>  -1063,8 +1063,10  <at>  <at>  While entering the regexp, completion on knows citation
keys is possible.
                ((= l ?T) (reftex-abbreviate-title
                           (reftex-get-bib-field "title" entry)))
                ((= l ?v) (reftex-get-bib-field "volume" entry))
-               ((= l ?y) (reftex-get-bib-field "year" entry)))))
-
+               ((= l ?y) (reftex-get-bib-field "year" entry))
+	       ;; zotero path to the (pdf) file
+               ((= l ?z) (nth 1 (split-string
+				 (reftex-get-bib-field "file" entry) ":"))))))
       (if (string= rpl "")
           (setq b (match-beginning 2) e (match-end 2))
         (setq b (match-beginning 3) e (match-end 3)))

Gmane