2

I want to use emacs org-mode to take notes of my bibliography. I am trying to capture some fields from a bibtex file and insert them into an org file with the org-ref-open-bibtex-notes. This is not working for me.

For example, I have a bibliography.bib:

@comment -*- org-ref-bibliography-notes: "./articles.org" -*-

@article{Mouhot2010,
  author = {Mouhot, C. and Villani, C.},  
  title = {{Landau Damping}},
  journal = {J. Math. Phys.},
  number = {1},
  volume = {51},
  year = {2010},
  doi = {10.1063/1.3285283},
}

The first line sets the local variable org-ref-bibliography-notes to "./articles.org". If I run M-x org-ref-open-bibtex-notes, the file ./articles.org is populated with:

# -*- org-ref-default-bibliography: ("./articles.bib") -*-

** TODO - 
 :PROPERTIES:
  :Custom_ID: 
  :AUTHOR: 
  :JOURNAL: 
  :YEAR: 
  :VOLUME: 
  :PAGES: 
  :DOI: 
  :URL: 
 :END:

cite:

The bibtex fields like author or year are empty. How can I capture these fields? Alternatively, I would like to get the following output:

# -*- org-ref-default-bibliography: ("./articles.bib") -*-

* Mouhot and Villani (2010): Landau Damping
  :PROPERTIES:
   :Custom_ID: cite:Mouhot2010
  :END:

I am using emacs 24.5.1, org 20190812 (orgmode elpa) and org-ref 20190802.1327 (melpa)

Drew
  • 75,699
  • 9
  • 109
  • 225
vagoberto
  • 131
  • 6
  • This works as expected for me, **if point (i.e., the cursor) is in the entry when I call the function**. If point is anywhere before the entry then I get an empty note like you see. Can you confirm you still have a problem when you put the cursor inside the entry before you try to open the note? – Tyler Aug 13 '19 at 19:48
  • @Tyler I have tried putting the cursor on Mouhot2010, before it, after it, inside one of the other entries like author or journal, before and after the last brackets, and selecting (C-space) some regions or selecting the whole entry. I get the same result everytime :( – vagoberto Aug 13 '19 at 20:03
  • in that case I'm not sure what else to suggest. As I said, it works for me, so we'll need more information to figure this out. Maybe something here will help: https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems – Tyler Aug 13 '19 at 21:56
  • @Tyler Commented the line `(setq-default case-fold-search nil)` in my .emacs and it worked. The org-ref command probably uses case-insensitive searches. Thanks for leading me in the right direction. Should I close this? – vagoberto Aug 14 '19 at 00:28
  • That's kind of interesting, maybe a bug in org-ref? @johnkitchin – Tyler Aug 14 '19 at 17:47

1 Answers1

1

As stated in the comments, the statement (setq-default case-fold-search nil) conflicts somehow with the org-ref-open-bibtex-notes. The emacs wiki mentions that case-fold-search set to nil means that searches are case-sensitive, and non-nil means searches are case-insensitive. This variable affects how lots of programs work (as in this case).


On the final question, the :PROPERTIES: output can be configured, e.g.

(setq org-ref-note-title-format
   "* %A%y - %t
 :PROPERTIES:
   :Custom_ID: %k
   :AUTHOR: %4a
   :JOURNAL: %j *%v*, %p (%y)
   :DOI: %D
   :URL: %U 
 :END:

")

For help on scape codes like %A or %k, see M-x describe-function RET org-ref-reftex-format-citation.

After running M-x org-ref-bibliography-notes in the bibliography.bib buffer, I get

# -*- org-ref-default-bibliography: ("./articles.bib") -*-

* Mouhot2010 - Landau Damping
 :PROPERTIES:
   :Custom_ID: Mouhot2010
   :AUTHOR: Mouhot \& Villani
   :JOURNAL: J. Math. Phys. *51*, (2010)
   :DOI: 10.1063/1.3285283
   :URL: 
 :END:

cite:Mouhot2010

Since I use org-ref-open-bibtex-notes a lot, I have defined the C-c o shortcut:

(global-set-key (kbd "C-c o")  'org-ref-open-bibtex-notes)
vagoberto
  • 131
  • 6