org-ref 是 emacs orgmode 和 latex 模式使用的引用管理软件包,它不仅可能有效的管理参考文献,还可以管理 orgmode 的其它链接,并将其转化成 pdf 或者网页模式。org-ref 还可以通过 crossref, google scholar, doi, isbn 等直接查找并添加 reference 到 bib 文件中。对于学术研究来说,org-ref 还是一个非常方便的笔记软件,他与其它笔记软件相比,主要是依靠强大的 orgmode 的笔记整理功能,可以分类,标注,查询,整理并导出,而这所有的一切全都依靠纯文本的 org 文件。
由于 org-ref 运行在 emacs 的 orgmode 模式下面,而 org-mode 的强大更加让 org-ref 成为了强大的文献管理工具。你如果要开始写论文了,那么从计划的制定、文献阅读、笔记记录和整理、论文的写作、数据的处理、图表的生成和处理、程序的编写调试运行并集成到你的论文中一气呵成,没有任何需要离开 emacs 的地方。
详细内容请看官方网站:org-ref
推荐使用Spacemacs, 它让 emacs 的使用配置不再那么高高在上, Spacemacs 也有中文网站对其使用进行指导,请见子龙山人的https://github.com/zilongshanren, 子龙山人对 emacs 中文化,spacemacs 的介绍做出了很大的贡献,创建了emacs 中文社区。 在 spacemacs 里面,只需要在 layer 里面添加: bibtex layer,并 spc f e R 就可以完成安装,安装完成后需要进行简单的配置:
(defun dotspacemacs/layers()
(dotspacemacs-configuration-layers
'(
(bibtex :variables
bibtex-completion-pdf-field "file"
;;如果你想用 ivy 进行文献的插入管理,请使用 org-ref-default-bibliography
org-ref-default-bibliography 'org-ref-ivy-cite
bibtex-completion-bibliography "~/git/pdfs/fishway/fishway.bibfishway.bib"
bibtex-completion-library-path "~/git/pdfs/fishway"
org-ref-notes-directory "~/git/notes"
org-ref-bibliography-notes "~/git/article-note.org"
bibtex-completion-notes "~/git/article-note.org"
org-ref-pdf-directory "~/git/pdfs/fishway"
org-ref-default-bibliography "~/git/pdf/fishway/fishway.bib"
)
))
以下是官方的配置,我将此配置已经全部写到 spacemacs 的配置里面去了,所以以下配置你可以忽略。
(setq reftex-default-bibliography '("~/Dropbox/bibliography/references.bib"))
;; see org-ref for use of these variables
(setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")
如果您的 bib 文件来自于 zoter,jabref 或者 mendely, 详细设置请参考helm-bibtex ,需要作如下单独设置:
(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)
(org-open-file pdf-file)
(message "No PDF found for %s" key))))
(setq org-ref-open-pdf-function 'my/org-ref-open-pdf-at-point)
对于 Mendeley 用户来说,需要作如下单独设置:
(setq org-ref-open-pdf-function 'org-ref-get-mendeley-filename)
如果你的配置没有问题,使用 org-ref 需要打开,或者新建一个 org 文件,例如:
#+include: ../head.org
#+latex_class: elsarticle
#+latex_class_options:[5p]
#+options: title:nil author:nil
#+title: Title
#+Author: Xiaoyun Yu
#+BEGIN_abstract
Abstract Content
#+END_abstract
#+BEGIN_keyword
Keyword1, keyword2, \cdots
#+END_keyword
#+include: ../authors.org
* Introduction
* Methodology
* Model
* Conclusion and Discussion
* References
bibliography:~/git/pdf/fishway/fishway.bib
bibliographystyle:unsrt
以上模板需要参照你自己的情况进行修改: 模板下载 。 然后在您需要插入参考文献的位置按:C-c ], 就可以弹出参考文献列表,此时你可以输入关键字,helm 会为你选择并定位你需要处理的参考文献条目,如果您只需要插入文献,直接按 ret(回车),如果您需要其它的操作,请按 tab 键,会弹出菜单让你选择相应的操作,比如你要添加笔记,你需要打开 pdf 等相关的操作。
当你插入参考文献的条目后,在 org 里面会显示一个链接,光标移动到此链接上时,会在 Emacs 的底部显示文献的内容。也可以用鼠标点此链接选择菜单相应的内容(当然在 emacs 里面操起鼠标,显得太俗,所以 spacemacs 里面的 vim 模式,可以轻松的回车选择菜单进行操作)。
1. 子龙山人的 emacs book 2. Org-ref 3. helm-bibtex 4. kitchin Research Group 是一个专门讨论用 emacs, orgmode, org-ref 写学术论文的站点
在 emacs 里面有很多看 pdf 文件的办法,但很多时候,在现在的桌面环境里面,用 Window, mac 自身的 pdf 阅读软件依然是很多 emacs 用户的选择,现在介绍一下如何在 emacs 里面用外部程序打开 pdf. 方法是使用 openwith 插件。 在 emacs 里面使用
M-x package-install ret
openwith
完成安装后,运行:
M-x customize-group
ret
openwith
进行设置,有两个变量需要设置。
- openwith-associations: ins, file 域填文件类型比如: .pdf, program 域填写打开的程序,比如:
C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe
parameters 域里面填写: (file) 用同样的方法添加需要打开的其它类型文件。
- openwith mode, 直接点 toggle
设置完成后点上面的 Apply and Save 按纽,对设置进行保存并立即生效。
设置完成后,打开你的配置文件,可以看到如下配置:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(openwith-associations
(quote
((".pdf" "C:\\Program Files\\Tracker Software\\PDF Viewer\\PDFXCview.exe"
(file)))))
'(openwith-mode t)
)
如此设置就可以了,对于 mac os 系统和 linux 系统,设置方法类似。而且比在 windows 里面略简单,这里不重复了。
在*ux 系统(包括 mac osx)下面,都可以很方便的进行文件或者目录的链接,这样可以让你的文件存储路径与你的访问路径对应起来,一般来说,我们的文件可能存在同步盘里面,也可以分散在很电脑的不同分区,不同的目录,有的甚至目录的级别很深,这样就需要添加一个快捷方式直入主题,找到需要的文件,链接就相当有用了。通常情况下在类*ux 系统下面,我们会使用如下的操作:
ln -s source-file-or-directory-path destination-path-file
但在 windows 下面,且有些不同,可以使用如下的命令:
mklink /j destination-path source-path
这里需要注意的是:1.windows 的路径使用的是’';2.windows 的目标和源路径与*ux 系统的是相反的;3.mklink 还有个选项 /d, 与/j 类似,都是作目录链接,但我理解/d 是硬链接,而/j 是符号连接,因为我最开始用的/d 在本来是已经建立链接目录里面再进行链接,结果异常,换成了/j 就正常了,所以以后建议大家都直接用 /j。 是不是很有用?