emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* managing articles in my personal library, and their citational material, using org mode instead of bibtex
@ 2013-11-19  1:40 Christopher W. Ryan
  2013-11-19  8:28 ` Ian Barton
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Christopher W. Ryan @ 2013-11-19  1:40 UTC (permalink / raw)
  To: emacs-orgmode

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.

Thanks.

--Chris Ryan
SUNY Upstate Medical University
Binghamton, NY

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: managing articles in my personal library, and their citational material, using org mode instead of bibtex
@ 2013-11-21  0:49 Jorge A. Alfaro Murillo
  0 siblings, 0 replies; 18+ messages in thread
From: Jorge A. Alfaro Murillo @ 2013-11-21  0:49 UTC (permalink / raw)
  To: Alan L Tyree; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 11008 bytes --]

I once tried to do something similar in org mode, at the end I thought I
was doing twice the work, so I ended up with just one big .bib file.

I copy the bib info from the website and then I have a function to yank it
a little bit cleaner into my bib file, something like this:

  (defun bibtex-yank-citation ()
    "Yanks a citation in a .bib file. Eliminates several fields,
  removes the key for the entry, and changes the abstract field for
  an annote field."
    (interactive)
    (goto-char (point-max))
    (let ((position (point)))
      (insert (current-kill 0))
      (goto-char position)
      (re-search-forward "\\(@.+?{\\).+?," nil t)
      (replace-match "\\1," nil nil)
      (goto-char position)
      (while (re-search-forward "%" nil t)
             (replace-match "\\\\%" nil nil))
      (goto-char position)
      (while (re-search-forward "’" nil t)
             (replace-match "'" nil nil))
      (goto-char position)
      (while (re-search-forward "á" nil t)
             (replace-match "{\\\\\'a}" nil nil))
      (goto-char position)
      (while (re-search-forward "é" nil t)
             (replace-match "{\\\\\'e}" nil nil))
      (goto-char position)
      (while (re-search-forward "í" nil t)
             (replace-match "{\\\\\'i}" nil nil))
      (goto-char position)
      (while (re-search-forward "ó" nil t)
             (replace-match "{\\\\\'o}" nil nil))
      (goto-char position)
      (while (re-search-forward "ú" nil t)
             (replace-match "{\\\\\'u}" nil nil))
      (goto-char position)
      (while (re-search-forward "ñ" nil t)
             (replace-match "{\\\\~n}" nil nil))
      (goto-char position)
      (while (re-search-forward "ç" nil t)
             (replace-match "{\\\\c{c}}" nil nil))
      (goto-char position)
      (while (re-search-forward "–" nil t)
             (replace-match "-" nil nil))
      (goto-char position)
      (delete-matching-lines

"^[[:space:]]*\\(keywords\\)\\|\\(note\\)\\|\\(url\\)\\|\\(jstor\\)\\|\\(doi\\)\\|\\(issn\\)\\|\\(html\\)\\|\\(language\\)\\|\\(copyright\\)\\|\\(eprint\\)")
      (goto-char position)
      (while (re-search-forward "\\(^[[:space:]]*\\)abstract" nil t)
             (replace-match "annote" nil nil))))


It also removes the key, so that then I just add extra information into the
annote field and then I generate the key with C-c C-c (bibtex-clean-entry).
You can configure your key type very specifically. See all the variables
bibtex-autokey-

That takes care of the new bibtex entry without effort. Now I have

  (defun bibtex-kill-ring-save-key ()
    "Kill-ring-save the bibtex key."
    (interactive)
    (let ((position (point)))
      (if (not (eq (point-max) position))
          (forward-char))
      (search-backward-regexp "^@" nil nil)
      (search-forward "{")
      (copy-region-as-kill (point)
                           (funcall (lambda ()
                                      (search-forward ",")
                                      (backward-char)
                                      (point))))
      (goto-char position)))

To save the key to the kill-ring, and then I save the paper with that
filename under a unique folder.

Finally I have a function that opens the respective pdf when the cursor is
within one entry. And keys for the functions, bound to Hyper keys:
  (eval-after-load "bibtex" '(progn
                               (define-key bibtex-mode-map
                                 (kbd "H-y") 'bibtex-yank-citation)
                               (define-key bibtex-mode-map
                                 (kbd "H-r") 'bibtex-kill-ring-save-key)
                               (define-key bibtex-mode-map
                                 (kbd "H-o")
'bibtex-open-reference-at-point)))

I even have a similar function that I use globally:
      (defun open-reference-at-point ()
        (interactive)
        (er/expand-region 2)
        (let* ((beg (region-beginning))
              (end (region-end))
              (article-name (buffer-substring beg end)))
          (call-process "evince" nil 0 nil
                        (concat "~/documents/references/articles/"
                                article-name
                                ".pdf")))
        (keyboard-quit))

So if I am in LaTeX, it is enough to call open-reference-at-point over the
text in \cite{...} and the pdf opens automatically.

As you can see everything just depends on using one folder for all the
references, one file for all the bib entries and the same name of the key
dot pdf for the pdf name. And you end up with an automatically super good
documented bib file. Which is very handy when you call C-c [ in LaTeX
(reftex-citation) and just vaguely remember something about what you want
to cite. Also if you want to open a certain reference you can search your
well documented bib file and open the reference with one key.

One last thing to get navigation a la org mode (C-c C-p and C-c C-n) and
folding with TAB in your bib file:

  (defun bibtex-previous-entry ()
    "Go to the previous bibtex entry."
    (interactive)
    (search-backward-regexp "^@" nil nil 2)
    (search-forward "{"))

  (defun bibtex-next-entry ()
    "Go to the next bibtex entry."
    (interactive)
    (search-forward-regexp "^@")
    (search-forward "{"))

  (add-hook 'bibtex-mode-hook (lambda ()
                                (hs-minor-mode)
                                (hs-hide-all)))

  (eval-after-load "bibtex" '(progn
                               (define-key bibtex-mode-map
                                 (kbd "<tab>") 'hs-toggle-hiding)
                               (define-key bibtex-mode-map
                                 (kbd "C-c C-p") 'bibtex-previous-entry)
                               (define-key bibtex-mode-map
                                 (kbd "C-c C-n") 'bibtex-next-entry)))

This almost makes you forget that you are actually in a bib file and not an
org-mode file.

Cheers,

Jorge.

On 20/11/13 14:37, Eric Schulte wrote:
> Alan L Tyree <alantyree@gmail.com> writes:
>
>> On 20/11/13 03:25, Eric Schulte wrote:
>>> Ian Barton <lists@wilkesley.net> 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.
>>>>>
>>>> Can't help with managing the citations in org, as the last time I had
>>>> to do this I was using a card index file:)
>>>>
>>>> However, to address your other questions one way of doing this would
>>>> be to create an org file with a heading for each article:
>>>>
>>>> * Article 1.
>>>> Here are some notes.
>>>>
>>>> * Article 2
>>>> My notes
>>>>
>>> I've been using such an org file for most of grad school and I couldn't
>>> be happier with the results.  I have a single reading.org file with one
>>> top-level entry for each article I read.  Currently at 533 articles
>>> (many still tagged TODO) and 16,558 lines.
>>>
>>> To create each headline, I first copy the bibtex information onto my
>>> clipboard, then I call `org-bibtex-yank' which converts the bibtex
>>> information into a headline with properties. E.g.,
>>>
>>>       * Software mutational robustness
>>>         :PROPERTIES:
>>>         :TITLE:    Software mutational robustness
>>>         :BTYPE:    article
>>>         :CUSTOM_ID: schulte2013software
>>>         :YEAR:     2013
>>>         :ISSN:     1389-2576
>>>         :JOURNAL:  Genetic Programming and Evolvable Machines
>>>         :DOI:      10.1007/s10710-013-9195-8
>>>         :URL:      http://dx.doi.org/10.1007/s10710-013-9195-8
>>>         :PUBLISHER: Springer US
>>>         :KEYWORDS: Mutational robustness; Genetic programming; Mutation
testing; Proactive diversity; N-version programming; Neutral landscapes
>>>         :AUTHOR:   Schulte, Eric and Fry, ZacharyP. and Fast, Ethan and
Weimer, Westley and Forrest, Stephanie
>>>         :PAGES:    1-32
>>>         :LANGUAGE: English
>>>         :END:
>>>       file:papers/10.1007_s10710-013-9195-8.pdf
>>>
>>>       The arXiv preprint is up at http://arxiv.org/abs/1204.4224.
>>>
>>>       More notes...
>>>
>> Is there some easy way to import entire bibtex files in this way?
>>
> org-bibtex-import-from-file
>
>> I find citations to be frustrating. Is there some way that bibtex (or
>> org files such as the above) can be used to enter citations in an org
>> file so that they are exported correctly by the different exporters?
>>
>> Or is there someplace where all this information is gathered and I
>> just am too blind to see it?
>>
> I don't know, I personally use org-bibtex-export-to-kill-ring to convert
> citations to bibtex individually and manually.
I think I have a terminology problem. What I mean is to enter
something like \cite{mann82} in the text and have it spit out (Mann
1982) in each and every export as well as constructing an entry for
the bibliography.

Of course, the actual form of the output should be configurable to
some extent, but I'd be happy with one form that always comes out the
same.

Is that possible? I'm currently fudging the issue by entering a
Markdown style entry in the text, for example
[@mann82:_legal_aspec_money], exporting to Markdown and then using
Pandoc to get the final result.

Not elegant.

Cheers,
Alan

>> Thanks for any help.
>> Alan
>>
>> <SNIP>


-- 
Alan L Tyree                    http://www2.austlii.edu.au/~alan
Tel:  04 2748 6206              sip:typhoon@iptel.org

[-- Attachment #2: Type: text/html, Size: 13777 bytes --]

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

end of thread, other threads:[~2013-11-25 18:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19  1:40 managing articles in my personal library, and their citational material, using org mode instead of bibtex Christopher W. Ryan
2013-11-19  8:28 ` Ian Barton
2013-11-19 16:25   ` Eric Schulte
2013-11-20  2:48     ` Alan L Tyree
2013-11-20  3:37       ` Eric Schulte
2013-11-20  6:16         ` Alan L Tyree
2013-11-20  6:27           ` Jambunathan K
2013-11-21 21:14             ` Alan L Tyree
2013-11-22  4:04               ` Eric Schulte
2013-11-22  5:37                 ` Alan L Tyree
2013-11-25 10:06               ` Jambunathan K
2013-11-20 16:52     ` Richard Lawrence
2013-11-21 22:00       ` Eric Schulte
2013-11-22  4:03         ` Eric Schulte
2013-11-23  0:06         ` Richard Lawrence
2013-11-19 10:41 ` Karl Voit
2013-11-25 18:29 ` John Kitchin
  -- strict thread matches above, loose matches on Subject: below --
2013-11-21  0:49 Jorge A. Alfaro Murillo

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