Org-ref

about | blog | config | notes | github

1. Citations, Cross-References, Indexes, Glossaries for Org

Org-ref is a packae that adds various types of refences and links for Org-mode. It also provides a variety os sub-packages for downloading bibtex references and PDFs from various sources like ArXiV , DOI, and many more.

\begin{equation} \label{mytesteq} y = \sinh x \end{equation}

We can also insert links to papers like so, citet:holden2017

Warning (:warning): Warning: You are using deprecated variables in org-ref that will be removed in version 3.

The following variables will not be used in version 3:
- org-ref-bibliography-notes
- org-ref-default-bibliography
- org-ref-pdf-directory

They are replaced by these variables in `bibtex-completion':
- bibtex-completion-notes-path
- bibtex-completion-bibliography
- bibtex-completion-library-path

There are some other changes that are likely to break existing workflows, for example all non-LaTeX exports will be handled by CSL, and all the old export code has been removed.

For more details see https://github.com/jkitchin/org-ref/tree/org-ref-3#readme.

2. Configuration

2.1. Setup Dependencies

BibTeX Completions isn't actually necessary for this package, but since we use, we want to make sure that we use the same path variables for Org-ref so Let's load that in.

(require 'init-bibtex-completions)

Org-mode needs to also be loaded.

(require 'init-org)

2.2. Package Install

(use-package org-ref)

2.3. Sync Library Path

As mentioned before, let's make sure to sync our library path with BibTeX Completions. Also org-ref needs full file paths for some reason…

(setq reftex-default-bibliography bibtex-completion-bibliography)
(setq org-ref-bibliography-notes nil)
(setq org-ref-default-bibliography bibtex-completion-bibliography)
(setq org-ref-pdf-directory (car bibtex-completion-library-path))

2.4. Prefer User Labels for LaTeX

When exporting to LaTeX, let's make sure to tell the exporting process that we wish to use our own defined variables.

(setq org-latex-prefer-user-labels t)

2.5. Setup LaTeX Package Support for References

We need to add a few packages for LaTeX to load up so that exporting with BibTeX references works properly.

(add-to-list 'org-latex-default-packages-alist '("" "natbib" nil) t)
(add-to-list 'org-latex-default-packages-alist '("" "cleveref" nil) t)

2.6. Feature Provide

(provide 'init-org-ref)

3. Bibliography Test

We can now reference this equation like so, eqref:mytesteq

bibliographystyle:authordate1 bibliography:/home/zamlz/org/papers/references.bib

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)