From: Myles English <mylesenglish@gmail.com>
To: emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: using an exported zotero library with org-mode
Date: Tue, 19 Jun 2012 13:53:39 +0100 [thread overview]
Message-ID: <87ipeniht8.fsf@ed.ac.uk> (raw)
Hi,
In case anyone else is wondering about this.
There are now several examples of managing bibliographies and associated
papers in orgmode [1][2][3]. Typically these involve a collection of pdf journal
papers, a .bib file, notes.org and draft_paper.org. There has also been
a bit of discussion of zotero on this list.
The difference here is that I have been using Zotero [4] as the 'capture'; to
download papers and bibrefs. I recently found out that Zotero can export a
library of journal papers and includes the path to the attachment (the pdf
file) in the "file = {}" field.
The main advantage I am pointing out here is that the pdf file doesn't not
need to be renamed manually.
So, if the Zotero collection is exported from the GUI to ~/tmp/bib/library,
then the result is ~/tmp/library/library.bib, with entries such as "file =
{my.pdf:files/1/my.pdf:application/pdf}" and the pdf at
~/tmp/library/files/1/my.pdf
RefTex can't currently access the 'file' field (first noted in Sept 2011
[5]) and so needs this patch:
#+BEGIN_SRC elisp :tangle allow-file-field.patch
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
@@ -1063,8 +1063,10 @@ 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)))
#+END_SRC
And then the now-familiar setup in .emacs making use of the %z place
holder for the path to the pdf:
#+BEGIN_SRC elisp
(setq reftex-default-bibliography (quote("/home/myles/tmp/bib/library/library.bib")))
;; so that the functions contained in the strings can be evaluated
;; http://old.nabble.com/adding-datestamp-to-reftex-set-cite-format-td31794462.html
(defadvice reftex-format-citation (before eval-citation-format)
(setq format (eval format)))
(defun org-mode-reftex-setup ()
(load-library "reftex")
(and (buffer-file-name)
(file-exists-p (buffer-file-name))
(reftex-parse-all)
(progn
;enable auto-revert-mode to update reftex when bibtex file changes on disk
;;(global-auto-revert-mode t)
(reftex-parse-all)
;add a custom reftex cite format to insert links
(reftex-set-cite-format
'((?b . "[[bib:%l][%l-bib]]")
(?n . "[[notes:%l][%l-notes]]")
(?p . "[[library:%l][%z]]")
(?t . "%t")
(?h . (concat "* %l - %t\n:PROPERTIES:\n:Created: "
"<" (substring (format-time-string (org-time-stamp-format t t)) 1 -1) ">"
"\n:Custom_ID: %l\n:file: [[library:%z][file]]\n:bib: [[bib:%l][bib]]\n:END:\n"))))))
(define-key org-mode-map (kbd "C-c )") 'reftex-citation)
(define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search))
(add-hook 'org-mode-hook 'org-mode-reftex-setup)
(setq org-link-abbrev-alist
'(("bib" . "~/tmp/bib/library/library.bib::%s")
("notes" . "~/tmp/bib/notes.org::#%s")
("library" . "~/tmp/bib/library/%s")))
#+END_SRC
A potential problem is what happens when the collection is re-exported
from zotero? But I will burn that bridge when I come to it.
Any comments are of course welcome but I am really just posting for
posterity.
Myles
Footnotes:
[1] http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/
[2] http://article.gmane.org/gmane.emacs.orgmode/2406/match=bibliography
[3] http://tincman.wordpress.com/2011/01/04/research-paper-management-with-emacs-org-mode-and-reftex/
[4] http://www.zotero.org/
[5] http://comments.gmane.org/gmane.emacs.auctex.devel/2662
next reply other threads:[~2012-06-19 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 12:53 Myles English [this message]
2012-06-19 16:47 ` using an exported zotero library with org-mode Yagnesh Raghava Yakkala
2012-06-19 20:37 ` Myles English
2012-06-19 22:06 ` Yagnesh Raghava Yakkala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ipeniht8.fsf@ed.ac.uk \
--to=mylesenglish@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).