emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* using an exported zotero library with org-mode
@ 2012-06-19 12:53 Myles English
  2012-06-19 16:47 ` Yagnesh Raghava Yakkala
  0 siblings, 1 reply; 4+ messages in thread
From: Myles English @ 2012-06-19 12:53 UTC (permalink / raw)
  To: emacs-orgmode Mode


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: using an exported zotero library with org-mode
  2012-06-19 12:53 using an exported zotero library with org-mode Myles English
@ 2012-06-19 16:47 ` Yagnesh Raghava Yakkala
  2012-06-19 20:37   ` Myles English
  0 siblings, 1 reply; 4+ messages in thread
From: Yagnesh Raghava Yakkala @ 2012-06-19 16:47 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

Myles English <mylesenglish@gmail.com> writes:

> 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.
[…]
> Any comments are of course welcome but I am really just posting for
> posterity.
>

FWIW I have been using zotexo[1] which does automatic exportation to bib file
from a Zotero collection and org-mode, reftex with similar simple setup as you
described for writeup. Zotexo interacts with MozRepl[2] for the
exportation. The setup for zotexo very simple with just couple of file local
variables.

But I haven't yet integrated note taking with org-mode. your setup
is looks nice, thanks for sharing..

Ideally It would be nice to have a elisp interface with zotero client API(js)
just as Magit for Git (Since Zotero UI is not so pretty for a Emacs user). It
seems possible, but would be huge task.

Another small info, Recently I crossed the zotero.org account limit 100mb (free),
So now I switched to cloudme[3] which is offering free WebDAV service for upto 3gb.

Thanks.,
Yagnesh

Footnotes: 
[1]  https://github.com/vitoshka/zotexo
[2]  https://github.com/bard/mozrepl
[3]  http://www.cloudme.com/en

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: using an exported zotero library with org-mode
  2012-06-19 16:47 ` Yagnesh Raghava Yakkala
@ 2012-06-19 20:37   ` Myles English
  2012-06-19 22:06     ` Yagnesh Raghava Yakkala
  0 siblings, 1 reply; 4+ messages in thread
From: Myles English @ 2012-06-19 20:37 UTC (permalink / raw)
  To: Yagnesh Raghava Yakkala; +Cc: emacs-orgmode Mode


Yagnesh,

>> On Wed, 20 Jun 2012 01:47:30 +0900, Yagnesh Raghava Yakkala said:

  > Hello,

  > Myles English <mylesenglish@gmail.com> writes:

  >> 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.
  > […]
  >> Any comments are of course welcome but I am really just posting for
  >> posterity.
  >> 

  > FWIW I have been using zotexo[1] which does automatic exportation to bib file
  > from a Zotero collection and org-mode, reftex with similar simple setup as you
  > described for writeup. Zotexo interacts with MozRepl[2] for the
  > exportation. The setup for zotexo very simple with just couple of file local
  > variables.

Thanks for the suggestion.

Do you know if it exports the collection's (pdf) files too or just a
.bib file?

The front page says it can "synchronize BibTex file and Zotero
collection" so can you really edit the .bib file and write the changes
back to Zotero, from emacs?


  > But I haven't yet integrated note taking with org-mode. your setup
  > is looks nice, thanks for sharing..

  > Ideally It would be nice to have a elisp interface with zotero client API(js)
  > just as Magit for Git (Since Zotero UI is not so pretty for a Emacs user). It
  > seems possible, but would be huge task.

The way I use it now, I can't really imagine how that might be useful, I
think Zotero is best as a 'capture' tool, no doubt if such a thing
existed I would probably find it indispensable.

  > Another small info, Recently I crossed the zotero.org account limit 100mb (free),
  > So now I switched to cloudme[3] which is offering free WebDAV service for upto 3gb.

  > Thanks.,
  > Yagnesh

  > Footnotes: 
  > [1]  https://github.com/vitoshka/zotexo
  > [2]  https://github.com/bard/mozrepl
  > [3]  http://www.cloudme.com/en


-- 
Myles

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: using an exported zotero library with org-mode
  2012-06-19 20:37   ` Myles English
@ 2012-06-19 22:06     ` Yagnesh Raghava Yakkala
  0 siblings, 0 replies; 4+ messages in thread
From: Yagnesh Raghava Yakkala @ 2012-06-19 22:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Myles English


Hello Myles,

Myles English <mylesenglish@gmail.com> writes:

> Do you know if it exports the collection's (pdf) files too or just a
> .bib file?

No it doesn't.

I wonder what is the purpose of retrieving pdfs from a collection., Since even
after retrieval from zotero, (in rdf format) Its hard to search/open a needed
pdf file.

In any case if retrieval of a collection is important, one easy way to it would
be using pyzotero[1][2].

> The front page says it can "synchronize BibTex file and Zotero
> collection" so can you really edit the .bib file and write the changes
> back to Zotero, from emacs?

No, It only syncs one way i.e., references from zotero collection to
bib. Nothing more.

Footnotes: 
[1]  https://github.com/urschrei/pyzotero
[2]  http://pyzotero.readthedocs.org/en/latest/#retrieving-collections

Yagnesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-22  3:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 12:53 using an exported zotero library with org-mode Myles English
2012-06-19 16:47 ` Yagnesh Raghava Yakkala
2012-06-19 20:37   ` Myles English
2012-06-19 22:06     ` Yagnesh Raghava Yakkala

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).