[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] managing articles in my personal library, and their citational m

From: Eric Schulte
Subject: Re: [O] managing articles in my personal library, and their citational material, using org mode instead of bibtex
Date: Thu, 21 Nov 2013 15:00:00 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Richard Lawrence <address@hidden> writes:

> Eric Schulte <address@hidden> writes:
>> Ian Barton <address@hidden> 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 %?
>    :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

Very cool,

I think some of these functions could be merged into
contrib/lisp/org-bibtex-extras.el to very good effect.  In the mean time
I just pushed up a small change to this file which will resolve cite:
links and export them correctly to LaTeX.


Eric Schulte
PGP: 0x614CA05D

reply via email to

[Prev in Thread] Current Thread [Next in Thread]