Sphinx extension for BibTeX style citations.
Project description
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.
Download: https://pypi.org/project/sphinxcontrib-bibtex/#files
Documentation: https://sphinxcontrib-bibtex.readthedocs.io/en/latest/
Development: https://github.com/mcmtroffaes/sphinxcontrib-bibtex/
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].
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinxcontrib-bibtex-2.4.1.tar.gz
.
File metadata
- Download URL: sphinxcontrib-bibtex-2.4.1.tar.gz
- Upload date:
- Size: 108.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 282223309bbaf34cd20a8fe1ba346fe8642f403a8930607e77a8cb08ae81fc5f |
|
MD5 | d7501cac34570cb48b0811da8d9e08f0 |
|
BLAKE2b-256 | f410ecad27f98f3ba90830c9b0d017a69b8fd491e036c10419e6ff5f042cc91b |
File details
Details for the file sphinxcontrib_bibtex-2.4.1-py3-none-any.whl
.
File metadata
- Download URL: sphinxcontrib_bibtex-2.4.1-py3-none-any.whl
- Upload date:
- Size: 39.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7da94e960a855c07c6816c7b0f4e8619b5b3ada00a5cb99b1eaa847a788f779 |
|
MD5 | 60d74785dbcffc75ff6d078c4971f21f |
|
BLAKE2b-256 | 1d434dfac9f2ebcc2c52a06b0fa2d5fd1ec7b3ab46832c90901e5479b2cb4b93 |