]> git.donarmstrong.com Git - org-ref.git/blob - org-ref.org
61fdc6a88a8de4610f0b7d7b877ea2cdabc1bd3d
[org-ref.git] / org-ref.org
1 #+TITLE: The org-ref manual
2 #+AUTHOR: John Kitchin
3 #+DATE: 2015-03-15 Sun
4
5 * Introduction to org-ref
6 Org-ref is an addon library for org-mode cite:Dominik201408 that provides rich support for citations, and cross-references in org-mode. org-ref is especially suitable for org-mode documents destined for LaTeX export.
7
8 The basic idea of org-ref is that it defines a set of functional org-mode links for citations, cross-references and labels that export properly to LaTeX, and that provide clickable functionality to the user. org-ref interfaces with helm-bibtex to facilitate citation entry.
9
10 org-ref provides a fairly large number of utilities for finding bad citations, extracting bibtex entries from citations in an org-file, and functions for interacting with bibtex entries. We find these utilities indispensable.
11
12 org-ref is [[id:32B558A3-7B48-4581-982B-082017B0AEE8][customizable]].
13
14 ** Basic usage of org-ref
15
16 *** Sources of bibtex entries
17 org-ref uses the [[bibliography link]] to determine which bibtex files to get citations from, and falls back to the bibtex files defined in the variable  reftex-default-bibliography.
18
19 *** Citations
20     :PROPERTIES:
21     :CUSTOM_ID: citations
22     :END:
23 For simple citation needs, org-ref is simple to use. At the point you want to insert a citation, you select the "Org -> org-ref -> Insert citation" menu, select the reference(s) you want in the helm-bibtex buffer and press enter. The citation will be inserted automatically into your org-file. If the cursor is on a citation key, you should see a message in the minibuffer that summarizes which citation it refers to. If you click on a key, you should see a helm selection buffer with some actions to choose, including opening the bibtex entry, opening/getting a pdf for the entry, searching the entry in Web of Science, etc...
24
25 The default citation type is [[id:32B558A3-7B48-4581-982B-082017B0AEE8][customizable]], and set to "cite". If you want another type of citation type, then type C-u before pressing enter in the helm-bibtex selection buffer. You will be prompted for the type of citation you actually want.
26
27 If the cursor is on a citation, or at the end of the citation, and you add another citation, it will be appended to the current citation.
28
29 If you want to /replace/ an existing key in a citation, put the cursor on the key, run the insert citation command, and type C-u C-u before pressing enter in the helm-bibtex selection buffer. The key will be replaced. Of course, you can just delete it yourself, and add a new key.
30
31 Finally, if you do not like the order of the keys in a citation, you can put your cursor on a key and use shift-arrows (left or right) to move the key around. Alternatively, you can run the command org-ref-sort-citation-link which will sort the keys by year, oldest to newest.
32
33 org-ref has basic support for pre/post text in citations. We have very little need for this in scientific publishing; we write pre text before the citation, and post text after it. However, you can get pre/post text by using a description in a cite link, with pre/post text separated by ::. For example, [[cite:Dominik201408][See page 20::, for example]].
34
35 *** label links
36 LaTeX uses labels to define places you can refer to. These can be labels in the captions of figures and tables, or labels in sections.
37
38 Or you can put a label link into a caption like this.
39 #+caption: Another simple table. label:tab-ydata
40 | y |
41 | 4 |
42 | 5 |
43
44 org-ref can help you insert unique labels with the command elisp:org-ref-helm-insert-label-link. This will show you the existing labels, and insert your new label as a link.
45
46 label links are "functional" if you put your cursor on the link, you will get a message in the minibuffer showing you the number of occurrences of that label in the buffer. That number should be one!
47
48 *** ref links
49 A ref link refers to a label of some sort. For example, you can refer to a table name, e.g. Table ref:table-1.
50
51 #+tblname: table-1
52 #+caption: A simple table.
53 | x |
54 | 1 |
55 | 2 |
56
57 Or you can refer to an org-mode label as in Table ref:table-3.
58
59 #+label: table-3
60 #+caption: A simple table.
61 | x |
62 | 1 |
63 | 2 |
64
65 You can also refer to an org-ref label link as in Table ref:tab-ydata.
66
67 To help you insert ref links, use the "Org->org-ref->Insert ref" menu, or run the command org-ref-helm-insert-ref-link.
68
69 ref links are functional. If you put the cursor on a ref link, you will get a little message in the minibuffer with some context of the corresponding label. If you click on the ref link, the cursor will jump to the label.
70
71 A brief note about references to a section. This only works if you put a label in the org-mode headline. Otherwise, you must use a CUSTOM_ID and a CUSTOM_ID link.
72
73 **** Miscellaneous ref links
74 org-ref provides a pageref, nameref and eqref link.
75
76 Note for eqref, you must use a LaTeX label like this:
77
78
79 \begin{equation}
80 e^x = 4 \label{eq:1}
81 \end{equation}
82
83 Then you can refer to Eq. eqref:eq:1 in your documents.
84
85 ** org-ref customization of helm-bibtex
86 org-ref adds a few new features to helm-bibtex. First, we add keywords as a searchable field. Second, org-ref modifies the helm-bibtex search buffer to include the keywords. Since keywords now can have a central role in searching, we add some functionality to add keywords from the helm-bibtex buffer as a new action.
87
88 We change the order of the actions in helm-bibtex to suit our work flow, and add some new actions. We define a format function for org-mode that is compatible with the usage defined in section [[#citations]]. Finally, we add some new fallback options for additional scientific search engines.
89
90 ** Some basic org-ref utilities
91 The command org-ref does a lot for you automatically. It will check the buffer for errors, e.g. multiply-defined labels, bad citations or ref links, and provide easy access to a few commands through a helm buffer.
92
93 org-ref-clean-bibtex-entry will sort the fields of a bibtex entry, clean it, and give it a bibtex key.
94
95 org-ref-extract-bibtex-entries will create a bibtex file from the citations in the current buffer.
96
97 ** LaTeX export
98 All org-ref links are designed to export to the corresponding LaTeX commands.
99
100 ** Other exports
101 There is some basic support for HTML and ascii export. Not all bibtex entry types are supported, but basic support exists for articles and books.
102
103 * Other utilities
104 These are mostly functions for adding to bibtex files, or for operating on bibtex files.
105
106 ** doi-utils
107 This library adds two extremely useful tools for getting bibtex entries and pdf files of journal manuscripts. Add this to your emacs setup:
108 #+BEGIN_SRC emacs-lisp
109 (require 'doi-utils)
110 #+END_SRC
111
112 The provides two important commands:
113
114 - doi-utils-add-bibtex-entry-from-doi
115 This will prompt you for a DOI, and a bibtex file, and then try to get the bibtex entry, and pdf of the article.
116
117
118 - doi-utils-add-entry-from-crossref-query
119 This will prompt you for a query string, which is usually the title of an article, or a free-form text citation of an article. Then you will get a helm buffer of matching items, which you can choose from to insert a new bibtex entry into a bibtex file.
120
121
122 ** isbn
123 #+BEGIN_SRC emacs-lisp
124 (require 'isbn)
125 #+END_SRC
126
127 This library provides some functions to get bibtex entries for books from their ISBN.
128
129 - isbn-to-bibtex
130
131 ** pubmed
132 #+BEGIN_SRC emacs-lisp
133 (require 'pubmed)
134 #+END_SRC
135
136 This library provides a number of new org-mode links to Pubmed entries. See http://www.ncbi.nlm.nih.gov/pmc/about/public-access-info/#p3 for details of these identifiers.
137
138 pmcid:PMC3498956
139
140 pmid:23162369
141
142 nihmsid:NIHMS395714
143
144 Also, you can retrieve a bibtex entry for a PMID with
145
146 - pubmed-insert-bibtex-from-pmid
147
148 ** arxiv
149 #+BEGIN_SRC emacs-lisp
150 (require 'arxiv)
151 #+END_SRC
152
153 This library provides an org-mode link to http://arxiv.org entries:  arxiv:cond-mat/0410285, and a function to get a bibtex entry and pdfs for arxiv entries:
154
155 - arxiv-add-bibtex-entry
156 - arxiv-get-pdf
157
158 ** sci-id
159 #+BEGIN_SRC emacs-lisp
160 (require 'sci-id)
161 #+END_SRC
162
163 This package just defines two new org-mode links for http://www.orcid.org, and http://www.researcherid.com. Here are two examples:
164
165 orcid:0000-0003-2625-9232
166
167 researcherid:A-2363-2010
168
169 ** jmax-bibtex
170 These are functions I use often in bibtex files.
171
172 - jmax-bibtex-generate-longtitles
173 - jmax-bibtex-generate-shorttitles
174 - jmax-stringify-journal-name :: replace a journal name with a string in
175      `jmax-bibtex-journal-abbreviations'
176 - jmax-set-journal-string :: in a bibtex entry run this to replace the journal
177      with a string
178 - jmax-title-case-article :: title case the title in an article
179 - jmax-sentence-case-article :: sentence case the title in an article.
180
181 - jmax-replace-nonascii :: replace nonascii characters in a bibtex
182      entry. Replacements are in `jmax-nonascii-latex-replacements'.
183
184 - jmax-title-case-article
185 - jmax-sentence-case-article
186
187 - jmax-bibtex-next-entry :: bound to M-n
188 - jmax-bibtex-previous-entry :: bound to M-p
189
190 - Functions to act on a bibtex entry or file
191   - jmax-bibtex-hydra/body :: gives a hydra menu to a lot of useful functions.
192   - jmax-bibtex-new-entry/body :: gives a hydra menu to add new bibtex entries.
193   - jmax-bibtex-file/body :: gives a hydra menu of actions for the bibtex file
194
195
196 * Appendix
197 ** Customizing org-ref
198    :PROPERTIES:
199    :ID:       32B558A3-7B48-4581-982B-082017B0AEE8
200    :END:
201 You will probably want to customize a few variables before using org-ref extensively. One way to do this is through the Emacs customization interface: [[elisp:(customize-group "org-ref")]].
202
203 Here is my minimal setup:
204 #+BEGIN_SRC emacs-lisp
205 (setq reftex-default-bibliography '("~/Dropbox/bibliography/references.bib"))
206
207 (setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
208       org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
209       org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")
210 #+END_SRC
211
212
213
214 * References
215 # <<bibliography link>>
216 bibliography:org-ref.bib