• Stars
    star
    1,292
  • Rank 36,420 (Top 0.8 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created almost 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.

org-ref: citations, cross-references, indexes, glossaries and bibtex utilities for org-mode

MELPA MELPA Stable

Overview of org-ref for export to PDF via LaTeX.

About org-ref

org-ref makes it easy to insert citations, cross-references, indexes and glossaries as hyper-functional links into org files. The links are fontified so you can tell them apart from other links, and each link is clickable to access functions like opening a pdf, notes or url associated with the link. Each link also can be exported to LaTeX to build a PDF. For citations, export to other formats is supported by citeproc for high quality export to HTML, markdown, plain text, or stand-alone (i.e. independent of a bibtex file) LaTeX. For a full explanation of the features in org-ref see ./org-ref.org.

What about org-cite?

A new syntax for citations was added in org-mode version 9.5. org-cite is designed to be very modular, with different processors for inserting, activating, following and exporting citations. It also uses a different cite/style type of syntax. It does not handle cross-references or provide any of the bibtex tools that are available in org-ref. The main advantages of org-cite include:

  1. It is built in to org-mode now
  2. It is highly modular, so you can configure it any way you want

It is possible to use org-cite for citation support instead of the org-ref citation links. You can configure the org-ref-insert-cite-function variable to use org-cite-insert. This will then use your org-cite configured processors to insert, follow, activate and export citations. You should avoid mixing org-ref citation links and org-cite citations. They are handled independently.

(setq org-ref-insert-cite-function
      (lambda ()
	(org-cite-insert nil)))

You can still use the org-ref cross-reference links if you use org-cite citations. These packages should be able to co-exist without issue.

Screenshots

Here are some annotated images of basic insertion of citations in org-mode. These are with the ivy backend.

./screenshots/introduction.png

This what an inserted link looks like.

./screenshots/cite-tooltip.png

The links in org-ref are hyper-functional (that means they have more than one action associated with them). They do things when your cursor is on them, or you click on them, and when the mouse hovers over them.

Here is an example of a menu of actions you get when you click on a cite link.

./screenshots/functional-cite-links.png

Here is a cross-reference link.

./screenshots/functional-links-2.png

org-ref can analyze your org-file and tell you about it, for example if there are bad citations, multiply defined labels, bad reference links, missing bibliography files, etc… You can select each one and it will jump to the location to help you fix it.

./screenshots/org-ref-analysis.png

Installation

Package installation via Melpa

org-ref has been added to Melpa. This is the recommended way to install org-ref as it should also install almost all the dependencies. It also should reflect what is in the master branch in the Github repo (https://github.com/jkitchin/org-ref).

(add-to-list 'package-archives
	     '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

Then, you should be able to do M-x package-list-packages, find org-ref and install it, or with

(use-package org-ref)

Two exceptions to packages that are not installed are helm, helm-bibtex, ivy and ivy-bibtex. You have to install those yourself. This change is to accommodate people who just can not stand having those packages installed if they do not use them.

Installation via github

Make sure all the dependencies are installed. Then clone this repo, add it to your load-path.

git clone https://github.com/jkitchin/org-ref.git

Add this to your .emacs file and see the *Configuration section.

Configuration

Version 3 has eliminated all the org-ref-* variables, and instead uses analogous variables defined in bibtex-completion.

There are some working configurations at https://github.com/jkitchin/org-ref/tree/master/melpa.

Here is how I have these variables set for myself.

(setq bibtex-completion-bibliography '("~/Dropbox/emacs/bibliography/references.bib"
					 "~/Dropbox/emacs/bibliography/dei.bib"
					 "~/Dropbox/emacs/bibliography/master.bib"
					 "~/Dropbox/emacs/bibliography/archive.bib")
	bibtex-completion-library-path '("~/Dropbox/emacs/bibliography/bibtex-pdfs/")
	bibtex-completion-notes-path "~/Dropbox/emacs/bibliography/notes/"
	bibtex-completion-notes-template-multiple-files "* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \n\nSee [[cite:&${=key=}]]\n"

	bibtex-completion-additional-search-fields '(keywords)
	bibtex-completion-display-formats
	'((article       . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}")
	  (inbook        . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}")
	  (incollection  . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
	  (inproceedings . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
	  (t             . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}"))
	bibtex-completion-pdf-open-function
	(lambda (fpath)
	  (call-process "open" nil 0 nil fpath)))

I also find these settings helpful for automatically generating bibtex keys.

(require 'bibtex)

(setq bibtex-autokey-year-length 4
      bibtex-autokey-name-year-separator "-"
      bibtex-autokey-year-title-separator "-"
      bibtex-autokey-titleword-separator "-"
      bibtex-autokey-titlewords 2
      bibtex-autokey-titlewords-stretch 1
      bibtex-autokey-titleword-length 5)

(define-key bibtex-mode-map (kbd "H-b") 'org-ref-bibtex-hydra/body)

After you set those options, you have these options to load org-ref.

If you prefer ivy-bibtex, you should use this. It requires ivy-bibtex, but this is not currently automatically installed by MELPA.

(require 'org-ref)
(require 'org-ref-ivy)

If you prefer helm, you can instead use this. This uses code from helm-bibtex for citation insertion. It requires helm-bibtex, but this is not currently automatically installed by MELPA.

(require 'org-ref)
(require 'org-ref-helm)

org-ref no longer binds keyboard shortcuts for you. You have some options here. To get the behavior of version 2, use this in your init file:

(define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link)
C-c ]
insert a citation
C-u C-c ]
insert a cross-reference
Cu C-u C-c ]
insert a label

or

(define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link-hydra/body)
  • C-c ] [:: insert a citation
C-c ] ]
insert a cross-reference
C-c ] \
insert a label

You can bind each insert command separately if you want after the library is loaded like this. Here I use the hyper key as a modifier, but you can choose anything you find convenient.

(define-key org-mode-map (kbd "H-c") org-ref-insert-cite-function)
(define-key org-mode-map (kbd "H-r") org-ref-insert-ref-function)
(define-key org-mode-map (kbd "H-l") org-ref-insert-label-function)

If you use some other completing-read backend like selectrum, or ido, then for a bare-bones library that uses vanilla completing-read, you can simply require β€˜org-ref. I don’t find the vanilla completing-read setup that useful on its own as it doesn’t do candidate narrowing or fuzzy matching without some external configuration. It is an option if you want it though.

(require 'org-ref)

You can use any other library that inserts links you want. Some of these include:

  1. citar (https://github.com/bdarcus/citar#configuration)
  2. ebib (https://joostkremers.github.io/ebib/)
  3. You could even roll your own insert functions.

LaTeX/PDF export

If you plan to build PDF files via LaTeX you need to make sure that org-latex-pdf-process is set to process the bibliography (using bibtex or biblatex). Here is one example of how to do that (see ./org-ref.org::*LaTeX export for other alternatives).

(setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))

Go forth and citate.

Some other useful libraries in org-ref

Note many of these have been renamed with an org-ref prefix.

x2bib
Convert bibliography formats to and from bibtex. In most cases, it relies on the command line bibutils package (available in source form at the link; can be installed on a Mac using Homebrew with brew install bibutils.

The following libraries are not loaded by default. They may be useful in specialist cases:

doi-utils
Download bibtex entries and PDFs from doi and crossref queries.
nist-webbook
Links to NIST Webbook resources
org-ref-arxiv
arxiv links, add bibtex entries from arxiv.org.
org-ref-bibtex
Utility functions for bibtex
org-ref-isbn
Add bibtex entries from a book ISBN
org-ref-pubmed
pubmed links, add bibtex entries from PMID.
org-ref-scifinder
one small function for searching SciFinder
org-ref-scopus
Scopus links and queries
org-ref-worldcat
One small function for searching Worldcat
org-ref-wos
WebOfKnowledge links and queries

The following libraries are still included, but they have been unreliable and are no longer recommended for use:

org-ref-pdf
Add drag-n-drop PDF to create bibtex entries (this code has not been reliable, and is no longer recommended for use)
org-ref-url-utils
Add drag-n-drop urls to create bibtex entries

Manual

For more information, see the org-ref manual, or preferably use M-x org-ref-help in emacs.

Errors and issues

Please report errors here: issues.

Contributors

I would like to thank the contributors to org-ref, and everyone who has filed an issue, or asked about org-ref on the org-mode Mailing list.

If you are interested in making a contribution to org-ref, I encourage you to reach out to me to discuss the idea first. The issue handler is a great way to do that, so that others can offer opinions too.

More Repositories

1

scimax

An emacs starterkit for scientists and engineers
Emacs Lisp
938
star
2

dft-book

A book on modeling materials using VASP, ase and vasp
Python
302
star
3

pycse

Python computations in science and engineering
HTML
225
star
4

jmax

Johns customizations to maximize emacs
Emacs Lisp
184
star
5

ox-ipynb

org-mode exporter to Jupyter notebooks
Jupyter Notebook
150
star
6

vasp

New ASE compliant Python interface to VASP
Python
109
star
7

emacs-modules

Dynamic modules for emacs
C
72
star
8

ox-clip

Copy formatted content from org-mode
Emacs Lisp
57
star
9

ov-highlight

A persistent highlighter for Emacs
Emacs Lisp
53
star
10

org-ref-cite

An org-cite processor that is like org-ref.
Emacs Lisp
42
star
11

magit-tutorial

37
star
12

dft-book-espresso

New version of dft-book for Quantum Espresso
Jupyter Notebook
32
star
13

jasp

python enhancements of ase.calculators.vasp
Python
27
star
14

dft-course

Course repository for 06-640 - Molecular simulation
Emacs Lisp
25
star
15

matlab-cmu

+cmu matlab package for units and other useful things.
MATLAB
23
star
16

python-reaxff

python wrappers for generating training files for the ReaxFF code
Python
21
star
17

scipy2013

19
star
18

f18-06623

Fall 2018 - Mathematical Modeling of Chemical Engineering Processes
Jupyter Notebook
19
star
19

techela-emacs

Technology enhanced learning and assessment
Emacs Lisp
17
star
20

s20-06681

Data science and machine learning in chemical engineering
Jupyter Notebook
12
star
21

s17-06364

Spring 2017 Chemical and Reaction Engineering
Jupyter Notebook
11
star
22

surfaces-book

Book for a course in surface science
11
star
23

devcontainer

Python package for using devcontainers locally
Python
10
star
24

python-atat

Python wrappers for the Alloy Theoretic Automated Toolkit
Python
9
star
25

htp

high-throughput tools for python - ssh and rsync
Python
8
star
26

matlab-wordpress

Matlab module for publishing m-files to a Wordpress blog
Objective-C
8
star
27

jkitchin.github.com

my blog
HTML
8
star
28

f15-06625

06-625 Chemical and Reactive Systems
Emacs Lisp
7
star
29

f19-06623

Course repository for 06-623
Jupyter Notebook
7
star
30

python-torque

My python module wrapping the Torque queue system
Python
6
star
31

f21-06623

Fall 2021 Mathematical Modeling of Chemical Engineering Processes
Jupyter Notebook
5
star
32

f16-06625

Chemical and Reactive Systems for Fall 2016
TeX
5
star
33

co2rr-rev

Reviewing the CO2RR literature
JavaScript
4
star
34

s22-06681

Course materials for data visualization and modeling
Jupyter Notebook
4
star
35

hyve

My Hy code
Hy
4
star
36

techela

Techela in a Flask
JavaScript
4
star
37

scipy-conference

talks I have given at the SciPy conference
3
star
38

sse

Jupyter Notebook
2
star
39

codespace

EJS
2
star
40

elpa

ELPA repository for my emacs packages
2
star
41

csearch

search utilities for Google colab
Jupyter Notebook
2
star
42

scimax-channel

See https://www.youtube.com/playlist?list=PL0sMmOaE_gs3E0OjExoI7vlCAVygj6S4I
TeX
2
star
43

expert-chainsaw

Shell
2
star
44

emacs-win

An emacs distribution for use with jmax
Emacs Lisp
2
star
45

dsmles

Jupyter Notebook
2
star
46

box-course

Python wrappers for the box.com v2 API
Python
1
star
47

texmf

LaTeX packages for writing scientific articles
1
star
48

jupyter-pycse

Jupyter Notebook
1
star
49

homebrew-scimax

A Tap for installing scimax via homebrew
Ruby
1
star
50

s23-example

1
star
51

scimax-win-elpa

Preinstalled elpa packages specifically for scimax on Windows
Emacs Lisp
1
star
52

claude-light-python

Python interface to Claude Light
Jupyter Notebook
1
star