Work Flow
Mendeley => Helm-bibtex => Org-ref
Pdf-tools and org-noter are used for note-taking.
Reference Manager Mendeley is used to:
-
to rename files
-
generate bibtex file
PDF-tools to render and annotate pdf, and generate notes in individual org files. see here for more info.
Org-ref to take care of the citation duty.
Notes: org-ref needs lots of other emacs extensions, including helmet-bibtex, which requires helm, to name a few.
Some Tweaks
open pdf file defined in file field generated by Mendeley, https://github.com/tmalsburg/helm-bibtex/issues/105
1 2 3 4 5 6 7 8 9 10 11 |
(defun my/org-ref-open-pdf-at-point () "Open the pdf for bibtex key under point if it exists." (interactive) (let* ((results (org-ref-get-bibtex-key-and-file)) (key (car results)) (pdf-file (car (bibtex-completion-find-pdf key)))) (if (file-exists-p pdf-file) (funcall bibtex-completion-pdf-open-function (car (bibtex-completion-find-pdf key))) (message "No PDF found for %s" key)))) (setq org-ref-open-pdf-function 'my/org-ref-open-pdf-at-point) |
open the notes file -not working yet??
1 2 3 4 5 6 7 8 9 10 11 |
(defun my/org-ref-open-notes-at-point () "Open the pdf for bibtex key under point if it exists." (interactive) (let* ((results (org-ref-get-bibtex-key-and-file)) (key (car results)) (pdf-file (car (bibtex-completion-find-pdf key)))) (if (file-exists-p pdf-file) (find-file (replace-regexp-in-string "\\(.*\\)\\..*\\'" "\\1.org" (car (bibtex-completion-find-pdf key)))) (message "No NOTES found for %s" key)))) (setq bibtex-completion-edit-notes 'my/org-ref-open-notes-at-point) |
Temp alternative solution for above: open PDF first, then use C-c n to open the note file if exist. -tan
1 2 3 4 5 6 7 8 |
(defun open-pdf-notes () (interactive) ;; MUST (let ((f-name (concat (file-name-sans-extension buffer-file-name) ".org"))) (if (file-exists-p f-name) (find-file f-name) (message "No NOTES found")))) (global-set-key (kbd "C-c n") 'open-pdf-notes) |
Special additional tweaks for helm-bibtex to work with Mendeley generated database
thread here. add following in bibtex-completion-find-pdf-in-field in file bibtex-completion.el
1 2 |
for record = replace-regexp-in-string "{\\|}\\|\\\\" "" record |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
(defun bibtex-completion-find-pdf-in-field (key-or-entry) "Returns the path of the PDF specified in the field `bibtex-completion-pdf-field' if that file exists. Returns nil if no file is specified, or if the specified file does not exist, or if `bibtex-completion-pdf-field' is nil." (when bibtex-completion-pdf-field (let* ((entry (if (stringp key-or-entry) (bibtex-completion-get-entry1 key-or-entry t) key-or-entry)) (value (bibtex-completion-get-value bibtex-completion-pdf-field entry))) (cond ((not value) nil) ; Field not defined. ((f-file? value) (list value)) ; A bare full path was found. ((-any 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path))) (-filter 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path)))) (t ; Zotero/Mendeley/JabRef format: (let ((value (replace-regexp-in-string "\\([^\\]\\);" "\\1\^^" value))) (cl-loop ; Looping over the files: for record in (s-split "\^^" value) ; Replace unescaped colons by field separator: for record = (replace-regexp-in-string "\\([^\\]\\|^\\):" "\\1\^_" record) ; Unescape stuff: for record = (replace-regexp-in-string "\\\\\\(.\\)" "\\1" record) ;;add following for Mendeley record reading for record = (replace-regexp-in-string "{\\|}\\|\\\\" "" record) ; Now we can safely split: for record = (s-split "\^_" record) for file-name = (nth 0 record) for path = (or (nth 1 record) "") for paths = (if (s-match "^[A-Z]:" path) (list path) ; Absolute Windows path ; Something else: (append (list path (f-join (f-root) path) ; Mendeley #105 (f-join (f-root) path file-name)) ; Mendeley #105 (--map (f-join it path) (-flatten bibtex-completion-library-path)) ; Jabref #100 (--map (f-join it path file-name) (-flatten bibtex-completion-library-path)))) ; Jabref #100 for result = (-first 'f-exists? paths) if (not (s-blank-str? result)) collect result))))))) |
Another tweak is to open the note file from helm-bibtex:
1 2 3 4 5 6 7 8 9 |
(defun bibtex-completion-edit-notes (key) "Redefine the bibtex-completion-edit-notes function only working with the same function name in dotemacs file." (let* ((pdf (car (bibtex-completion-find-pdf-in-field (car key)))) (note (replace-regexp-in-string "\\(.*\\).pdf" "\\1.org" pdf))) (if (file-exists-p note) (find-file note) (message "No NOTES found")))) |
Reference Management with Helm-Bibtex
Access reference
M-x helm-bibtex to start off, search for reference, Tab for options
M-o in ivy-bibitex
Email reference as email attachments
Helm-bibtex: Start an email session ( C-x m) and execute helm-bibtex ( M-x helm-bibtex). Search for your new publications and mark them with C-<space>, then press <f7> to execute the action “Attach PDF to email”. Then M-x helm-resume (the publications are still marked) and press <f6> to execute the action “Insert BibTeX entry”. Optionally insert more human readable references using M-x helm-resume and <f4> to execute the action “Insert reference”. Send email ( C-c C-c). Done. This takes less than 10 seconds.
Mendeley and Bibtex in Sync
Conversion of reference database
Preamble
There are cases that you will need to communicate with the Microsoft Word world during manuscript editing phase. What I do is to use Scimax package to convert the org-ref enhanced org file to Word format. And the following procedure was applied to render the references to an Endnote format.
Export bibtex from org-ref
You would need to export the entries from org-ref to bibtex format.
1 2 3 |
elisp: org-ref-extract-bibtex-to-file |
You will then need export the bibtex format with JabRef in RIS format and then import into EndNote. Please find the steps below.
Convert BibTex to Endnotes or RIS
Adapted from EndNote: Exporting JabRef references into EndNote.
Export to RIS format with JabRef:
- Open the database you want to export with JabRef.
- To export only selected entries (press the “Control” button on keyboard and select the entries to export).
-
Click on the File menu and select “Export selected entries” Note: To export whole database, click on the File menu and select “Export all entries”
-
Choose a location to save the RIS file.
- In Files of type, select RIS(*.ris).
- In the File name box, enter a name and click on Save.
Now you should have a .ris file created.
Convert from bibtex to endnotes format with bibutils
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# bibtex to Endnotes bib2xml bse-vit-update.bib | xml2end > bse-vit-update_bibutils.enw # Converting to RIS is similar: $ bib2xml input.bib | xml2ris > output.ris # bib2xml: Reference 15 has unused tags. # Author(s) (level=0): # 'Song|Ying' # 'Sharp|Randy' # 'Lu|Fenghua' # 'Hassan|Maliha' # Year(s) (level=0): # '2010' # Title(s) (level=0): # 'The future potential of cryopreservation for assisted reproduction' # Unused tags: # tag: 'ARCHIVEPREFIX' value: 'arXiv' level: 0 # bib2xml: Reference 40 has unused tags. # Author(s) (level=0): # 'Ghorai|S' # 'Banik|Sp' # 'Verma|D' # 'Chowdhury|S' # 'Mukherjee|S' # 'Khowala|S' # Year(s) (level=0): # '2011' # Title(s) (level=0): # 'Food Research International' # '3.51 - Fungal Biotechnology in Food and Feed Processing' # Unused tags: # tag: 'TITLE' value: '3.51 - Fungal Biotechnology in Food and Feed Processing' level: 0 # bib2xml: Processed 46 references. # xml2end: Processed 46 references. |
Import into EndNote.
- Open the EndNote database into which you want to import the references.
- From the File menu, choose Import -> File.
- From Import Options, select RefMan(RIS).
- Click on Choose and browse to the file location which was exported from JabRef.
- In Files of type, select “All Files (.)”.
- Now locate the RIS file exported from JabRef and select it.
- Click Import to begin importing references.
Now you should have your JabRef references imported into EndNote.
Resources
SEP
About the Author:
Beyond 8 hours - Computer, Sports, Family...