From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: managing articles in my personal library, and their citational material, using org mode instead of bibtex Date: Wed, 20 Nov 2013 08:52:58 -0800 Message-ID: <87ob5fgglx.fsf@berkeley.edu> References: <528AC19F.3000803@binghamton.edu> <528B2149.5040702@wilkesley.net> <87vbzo8ikr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjB5K-0006Qs-ED for emacs-orgmode@gnu.org; Wed, 20 Nov 2013 11:57:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjB5F-0004xX-8E for emacs-orgmode@gnu.org; Wed, 20 Nov 2013 11:57:02 -0500 Received: from plane.gmane.org ([80.91.229.3]:38125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjB5E-0004xR-Ut for emacs-orgmode@gnu.org; Wed, 20 Nov 2013 11:56:57 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VjB5D-0001xT-6d for emacs-orgmode@gnu.org; Wed, 20 Nov 2013 17:56:55 +0100 Received: from c-67-164-45-159.hsd1.ca.comcast.net ([67.164.45.159]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Nov 2013 17:56:55 +0100 Received: from richard.lawrence by c-67-164-45-159.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Nov 2013 17:56:55 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Eric Schulte writes: > Ian Barton writes: > >> On 19/11/13 01:40, Christopher W. Ryan wrote: >>> Not sure "citational" is even a word, but hopefully it conveys my meaning! >>> >>> I've been using LaTeX for academic writing and reading for quite some >>> time, with emacs as my editor. I'm pretty familiar with managing a .bib >>> file containing all the references I've collected, and using it in LaTeX >>> \cite commands. >>> >>> I've come to org-mode more recently. I'm trying to imagine how I might >>> use it to manage my "personal library." I have a directory full of pdf >>> files, each a downloaded article. Some articles I reference in papers I >>> write; others I just read and want to keep. I also have a .bib file >>> where I put the citational material for all those articles. Whenever I >>> download an article, I add its entry to my .bib file. I tend to manage >>> this with JabRef because it searches Medline so easily, but I also will >>> edit the .bib file directly when necessary. >>> >>> I like the idea of an org file containing the citational information >>> (authors, title, journal, etc) *plus* links to the pdfs on my hard >>> drive, or on the internet. I could also include my notes about the >>> articles. But what would that org file look like? How do I insert a >>> reference to an article into the org file which contains the article I >>> am writing? >>> >>> I'd be grateful for any explanations, or links to tutorials. >>> I am also a grad student, and I use a setup which is similar to Eric's, but rather than importing from bibtex, I use Org's capture features to directly input the bibliographic data when I come across something I want to add to my reading list. I don't maintain a separate .bib file at all; rather I generate it as needed from the Org file containing my reading list. This setup allows me to think of readings as TODO items included in my agenda, take notes and make links in the entry, and also keep bibliographic data in Org (which I export via org-bibtex). Here's what my setup looks like: 1) A capture template for new readings. My template looks like this: ** %^{Todo state|FIND|PRINT|READ|NOTES} [#%^{Priority|A|B|C}] %^{Description|Reading} %^g %^{TITLE}p %^{AUTHOR}p %^{AREA}p %? :PROPERTIES: :Entered: %U :END: This template does not have a field for adding links to PDFs, but you could easily add that. 2) A hook to add bibliographic data to reading entries when finalizing a capture. I put this in my Org setup: ;; post-processing in capture templates (defun add-bibliographic-data () ; this is a bit hacky: we detect the AUTHOR property, and create bibtex entries if ; it is present (message "optionally adding bibliographic data") (if (and (org-entry-get (point) "AUTHOR") (y-or-n-p "Add bibliographic data? ")) ; with prefix arg to get all fields: (org-bibtex-create-in-current-entry 1) nil)) (add-hook 'org-capture-before-finalize-hook (lambda () (add-bibliographic-data))) There may be a better way to do this, but it works for me! 3) Elisp functions to export my entire reading list to .bib (these assume that your readings are not in a separate file, but under a top-level entry called "Reading list" in some other file): ;; lib/el/bib-export.el in my dissertation tree: (setq dissertation-bib-file "~/Documents/philosophy/dissertation/build/dissertation.bib") (defun add-headline-to-bib-buffer (bib-buffer) "Export headline at point to Bibtex into the given buffer" (let ((bib-entry (org-bibtex-headline)) (custom-id (org-entry-get (point) "CUSTOM_ID"))) (if (and custom-id bib-entry) (with-current-buffer bib-buffer (insert bib-entry))))) (defun export-subtree-to-bib-buffer (headline bib-buffer) "Export the entries in the subtree at point to Bibtex into the given buffer." (save-excursion (goto-char (org-find-exact-headline-in-buffer headline)) (org-map-entries (lambda () (add-headline-to-bib-buffer bib-buffer)) t ; match: all entries below this one 'tree ; scope: just this subtree ))) (defun reading-list-to-bibtex () "Export 'Reading list' headline in current buffer to dissertation.bib" (interactive) (let ((org-buffer (current-buffer)) (bib-buffer (create-file-buffer "dissertation.bib"))) (export-subtree-to-bib-buffer "Reading list" bib-buffer) (with-current-buffer bib-buffer (write-file dissertation-bib-file)))) 4) A Makefile entry to call the export functions: BATCH_EMACS=$(EMACS) --batch -Q bib: tasks.org lib/el/bib-export.el $(BATCH_EMACS) --load lib/el/bib-export.el --file tasks.org --funcall reading-list-to-bibtex Thus, I can run "make bib" in my dissertation tree and get a fresh export of all my readings to a .bib file. Hope that helps! Best, Richard