Skip to main content

Overview

The bibtex extension allows BibTeX citations to be inserted into documentation generated by Sphinx, via a bibliography directive, along with :cite:p: and :cite:t: roles. These work similarly to LaTeX’s thebibliography environment and the \citet and \citep commands.

For formatting, the extension relies on pybtex written by Andrey Golovizin. The extension is inspired by Matthew Brett’s bibstuff.sphinxext.bibref and Weston Nielson’s sphinx-natbib.

Installation

Install the module with pip install sphinxcontrib-bibtex, or from source using pip install -e .. Then add:

extensions = ['sphinxcontrib.bibtex']
bibtex_bibfiles = ['refs.bib']

to your project’s Sphinx configuration file conf.py.

Installation with python setup.py install is discouraged due to potential issues with the sphinxcontrib namespace.

Minimal Example

In your project’s documentation, you can use :cite:t: for textual citation references, :cite:p: for parenthetical citation references, and .. bibliography:: for inserting the bibliography. For example:

See :cite:t:`1987:nelson` for an introduction to non-standard analysis.
Non-standard analysis is fun :cite:p:`1987:nelson`.

.. bibliography::

where refs.bib would contain an entry:

@Book{1987:nelson,
  author = {Edward Nelson},
  title = {Radically Elementary Probability Theory},
  publisher = {Princeton University Press},
  year = {1987}
}

In the default style, this will get rendered as:

See Nelson [Nel87a] for an introduction to non-standard analysis. Non-standard analysis is fun [Nel87a].

[Nel87a] (1,2)

Edward Nelson. Radically Elementary Probability Theory. Princeton University Press, 1987.

Citations in sphinx are resolved globally across all documents. Typically, you have a single bibliography directive across your entire project which collects all citations. Advanced use cases with multiple bibliography directives across your project are also supported, but some care needs to be taken from your end to avoid duplicate citations.

In contrast, footnotes in sphinx are resolved locally per document. To achieve local bibliographies per document, you can use citations represented by footnotes as follows:

See :footcite:t:`1987:nelson` for an introduction to non-standard analysis.
Non-standard analysis is fun\ :footcite:p:`1987:nelson`.

.. footbibliography::

which will get rendered as:

See Nelson[1] for an introduction to non-standard analysis. Non-standard analysis is fun[1].

Note the use of the backslash escaped space to suppress the space that would otherwise precede the footnote.

Typically, you have a single footbibliography directive at the bottom of each document that has footnote citations. Advanced use cases with multiple footbibliography directives per document are also supported. Since everything is local, there is no concern with duplicate citations when using footnotes.

Release files for sphinxcontrib-bibtex 2.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinxcontrib-bibtex 2.4.2
File Size Uploaded
sphinxcontrib-bibtex-2.4.2.tar.gz 284.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sphinxcontrib-bibtex 2.4.2
File Interpreter ABI Platform
sphinxcontrib_bibtex-2.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 323.5 kB

Release files / sphinxcontrib-bibtex-2.4.2.tar.gz

Download URL sphinxcontrib-bibtex-2.4.2.tar.gz
Size 284.1 kB
Tags Source
SHA-256 checksum
How to use checksums
65b023ee47f35f1f03ac4d71c824e67c624c7ecac1bb26e83623271a01f9da86
BLAKE2b-256 checksum
How to use checksums
40178349d5dd28d71d2a25c7a6f317071b9360aefc3090a2abd475c8a5937811
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.11.0a5

Release files / sphinxcontrib_bibtex-2.4.2-py3-none-any.whl

Download URL sphinxcontrib_bibtex-2.4.2-py3-none-any.whl
Size 39.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
608512afde6b732148cdc9123550bd560bf48e071d1fb7bb1bab4f4437ff04f4
BLAKE2b-256 checksum
How to use checksums
44cc9b30e4b255da07ee8434eb13b02199f2b53003fa1b45b2a2bfbd5a179e4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.11.0a5

Release history Release notifications | RSS feed

2.7.0

2 release files

2.6.5

2 release files

2.6.4

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.0

2 release files

This release

2.4.2 This release

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page