Citation handling
While links (see Hyperlinks) are often sufficient to refer to external or internal information from Org, they have their limitations when referring to multiple targets or typesetting printed publications.
Org mode provides a more sophisticated markup to "cite" external resources. For example, consider the following Org mode snippet
#+bibliography: citationdata.bib Org mode is used by various communities [cite:teaching: @orgteaching; and TeX: @orgtex]. [cite/author/caps:@orgtex] uses Org mode to simplify writing scientific publications, while [cite/author/caps:@orgteaching] experiment with Org babel to improve teaching. #+print_bibliography:
Org mode will gather citation metadata from the #+bibliography
database and use it to typeset the exported document in arbitrary
formats. For example, the snippet below shows ASCII export output.
Org mode is used by various communities (teaching: Birkenkrahe, Marcus, 2023, and TeX: Somma, Emmanuele F, 2023). Somma, Emmanuele F uses Org mode to simplify writing scientific publications, while Birkenkrahe, Marcus experiment with Org babel to improve teaching. Birkenkrahe, Marcus (2023). /Teaching Data Science with Literate Programming Tools/, MDPI. Somma, Emmanuele F (2023). /Simplifying LaTeX with ORG-mode in Emacs/, TUGboat volume.
In addition to export, users can use completion to search and insert
citations from the bibliography (via org-cite-insert). Citations
also act like ordinary links, jumping to the citation metadata when
"following" them using org-open-at-point.
You can customize every aspect (capability) of citation handling using built-in or external citation processors.
Org mode ships with several built-in citation processors tailored to
work with LaTeX export and BibTeX bibliographies (bibtex,
biblatex, and natbib processors), or with more generic formats
described using Citation Style
Language (csl processor).
The default citation processor is basic - it works with arbitrary
export formats and recognizes both BibTeX and CSL bibliographies.
More citation processors are distributed as Emacs packages.
Multiple citation processors can be mixed to meet your preferences.
Configure org-cite-activate-processor, org-cite-follow-processor,
org-cite-insert-processor, and org-cite-export-processors to
select which processor to use for every citation capability:
- activate
- Fontification, tooltip preview, etc.
- follow
- At-point actions on citations via
org-open-at-point. - insert
- Add and edit citations via
org-cite-insert. - export
- Via different libraries for different target formats.
Citations
Before adding citations, first set one-or-more bibliographies, either
globally with org-cite-global-bibliography, or locally using one or
more "bibliography" keywords.
#+bibliography: SomeFile.bib #+bibliography: /some/other/file.json #+bibliography: "/some/file/with spaces/in its name.bib"
Org mode uses all the local and global bibliographies combined to search for citation keys.
One can then insert and edit citations using org-cite-insert, called
with C-c C-x @.
A citation requires one or more citation key(s), elements identifying a reference in the bibliography.
- Each citation is surrounded by brackets and uses the
citetype. -
Each key starts with the character
@.[cite:@key]
-
Each key can be qualified by a prefix (e.g. "see ") and/or a suffix (e.g. "p. 123"), giving information useful or necessary for the comprehension of the citation but not included in the reference.
[cite:see @key p. 123]
-
A single citation can cite more than one reference ; the keys are separated by semicolons ; the formatting of such citation groups is specified by the style.
[cite:@key1;@key2;@key3]
-
One can also specify a stylistic variation for the citations by inserting a
/and a style name between thecitekeyword and the colon; this usually makes sense only for the author-year styles.[cite/style:common prefix ;prefix @key suffix; ... ; common suffix]
When
styleis not specified, one of the two default styles are used-
either the default style specified in the
CITE_EXPORTkeyword (see Citation export processors)#+cite_export: basic numeric noauthor/bare [cite:@key] is the same as [cite/noauthor/bare:@key]
-
or, if
CITE_EXPORTis not set, using the defaultnilstyle[cite:@key] is the same as [cite/nil:@key]
-
The only mandatory elements are:
- The
citekeyword and the colon. - The
@character immediately preceding each key. - The brackets surrounding the citation(s) (group).
Citation export processors
Org currently includes the following export processors:
-
Two processors can export to a variety of formats, including
latex(and thereforepdf),html,odtand plain (UTF8) text:- basic
- a basic export processor, well adapted to situations where backward compatibility is not a requirement and formatting needs are minimal;
- csl
- this export processor uses format files written in Citation Style Language via citeproc-el;
-
In contrast, three other processors target LaTeX and LaTeX-derived formats exclusively:
- bibtex
- this export processor uses BibTeX, the historical
bibliographic processor used with LaTeX, thus allowing the use of
data and style files compatible with this processor (including a
large number of publishers' styles). It only supports LaTeX's
\citeand\nocitecommands. - natbib
- as with the bibtex processor, but using the LaTeX
package
natbib, allowing more stylistic variants that LaTeX's\citecommand. - biblatex
- this backend allows the use of data and formats prepared for BibLaTeX, an alternate bibliographic processor used with LaTeX, which overcomes some serious BibTeX limitations, but has not (yet?) been widely adopted by publishers.
The CITE_EXPORT keyword specifies the export processor, citation
style, and bibliography style; for example (all arguments are
optional)
#+cite_export: [export processor name] [bibliography style] [default citation style] #+cite_export: basic author-year author
specifies the basic export processor with citations inserted as
author's name and references indexed by author's names and year;
#+cite_export: csl /some/path/to/vancouver-brackets.csl
specifies the csl processor and CSL style, which in this case
defines numeric citations and numeric references according to the
Vancouver specification (as style used in many medical journals),
following a typesetting variation putting citations between brackets;
#+cite_export: natbib kluwer
specifies the natbib export processor with a label citation style
conformant to the Harvard style and the specification of the
Wolkers-Kluwer publisher; since it relies on the bibtex processor of
your LaTeX installation, it won't export to anything but PDF.
#+cite_export: biblatex numeric,backend=bibtex
specifies the biblatex export processor with the default numeric
style and the bibtex backend. Always define the style first and then
the rest of load-time options for the biblatex
package. Alternatively, you can use the key=val,key=val format for
the options as documented in the biblatex package documentation:
#+cite_export: biblatex backend=bibtex,style=numeric
The org-cite-biblatex-options variable in your Emacs configuration
uses this format. It will only export to PDF, since it relies on the
biblatex processor of your LaTeX installation.
Bibliography printing
The PRINT_BIBLIOGRAPHY keyword specifies where the bibliography
should be printed (note the colon):
#+print_bibliography:
The bibliography printed by the LaTeX-based export processors
bibtex, natbib and biblatex has a chapter or section heading by
default, while the basic and csl processors print the list of
bibliography entries without a heading.
A document may contain more than one PRINT_BIBLIOGRAPHY keywords.
Each of the keywords will trigger printing the bibliography.
The keywords can be used with or without additional options. Options
can be used, for example, to print only entries that belong to a
certain category or to control formatting. The set of supported
PRINT_BIBLIOGRAPHY options and their interpretation varies between
the different citation export processors. Some export processors do
not support passing options.
Bibliography options in the biblatex and csl export processors
The biblatex and csl export processors support bibliography
options through a property list attached to the PRINT_BIBLIOGRAPHY
keyword. For example,
#+print_bibliography: :keyword algebra :type book
Values including spaces must be surrounded with double quotes. If you need to use a key multiple times, you can separate its values with commas, but without any space in-between:
#+print_bibliography: :keyword "algebraic logic" :nottype article,book
The biblatex export processor accepts all options supported by
BibLaTeX's \printbibliography command.
The csl processor accepts the following options:
-
:keyword <keyword(,keyword2...)> - Print only entries whose keyword field contains all given keywords.
-
:notkeyword <keyword(,keyword2...)> - Print only entries whose keyword field does not contain any of the given keywords.
-
:type <entrytype> - Print only entries whose type is
<entrytype>. Entry type is the BibTeX/BibLaTeX entry type if this information is available (the entry was read from a BibTeX/BibLaTeX bibliography) and the CSL entry type otherwise. -
:nottype <entrytype(,entrytype2...)> - Print only entries whose
type is not among the given entry types. Entry type is determined
as in the case of
:type. -
:csltype <entrytype> - Print only entries whose CSL entry type
(possibly based on a conversion from BibTeX/BibLaTeX to CSL) is
<entrytype>. -
:notcsltype <entrytype(,entrytype2...)> - Print only entries whose CSL entry type (possibly based on a conversion from BibTeX/BibLaTeX to CSL) is not among the listed entry types.
-
:filter <predicate> - Print only entries for which the given
Emacs Lisp predicate returns a non-
nilvalue.