Sphinx extension for BibTeX style citations.
Project description
Sphinx extension for BibTeX style citations.
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinxcontrib_bibtex-2.6.5.tar.gz.
File metadata
- Download URL: sphinxcontrib_bibtex-2.6.5.tar.gz
- Upload date:
- Size: 118.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b3224dd6fece9268ebd8c905dc0a83ff2f6c54148a9235fe70e9d1e9ff149c0
|
|
| MD5 |
63bf59554402047615a4b50f31b0050a
|
|
| BLAKE2b-256 |
de831488c9879f2fa3c2cbd6f666c7a3a42a1fa9e08462bec73281fa6c092cba
|
Provenance
The following attestation bundles were made for sphinxcontrib_bibtex-2.6.5.tar.gz:
Publisher:
release.yml on mcmtroffaes/sphinxcontrib-bibtex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinxcontrib_bibtex-2.6.5.tar.gz -
Subject digest:
9b3224dd6fece9268ebd8c905dc0a83ff2f6c54148a9235fe70e9d1e9ff149c0 - Sigstore transparency entry: 253292125
- Sigstore integration time:
-
Permalink:
mcmtroffaes/sphinxcontrib-bibtex@97c63a433f7670bb3fde4e68930a6dbd141fdcaf -
Branch / Tag:
refs/tags/2.6.5 - Owner: https://github.com/mcmtroffaes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@97c63a433f7670bb3fde4e68930a6dbd141fdcaf -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinxcontrib_bibtex-2.6.5-py3-none-any.whl.
File metadata
- Download URL: sphinxcontrib_bibtex-2.6.5-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
455ea4509642ea0b28ede3721550273626f85af65af01f161bfd8e19dc1edd7d
|
|
| MD5 |
227d91605d252004c9fcd50259811235
|
|
| BLAKE2b-256 |
9ea03a612da94f828f26cabb247817393e79472c32b12c49222bf85fb6d7b6c8
|
Provenance
The following attestation bundles were made for sphinxcontrib_bibtex-2.6.5-py3-none-any.whl:
Publisher:
release.yml on mcmtroffaes/sphinxcontrib-bibtex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinxcontrib_bibtex-2.6.5-py3-none-any.whl -
Subject digest:
455ea4509642ea0b28ede3721550273626f85af65af01f161bfd8e19dc1edd7d - Sigstore transparency entry: 253292132
- Sigstore integration time:
-
Permalink:
mcmtroffaes/sphinxcontrib-bibtex@97c63a433f7670bb3fde4e68930a6dbd141fdcaf -
Branch / Tag:
refs/tags/2.6.5 - Owner: https://github.com/mcmtroffaes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@97c63a433f7670bb3fde4e68930a6dbd141fdcaf -
Trigger Event:
push
-
Statement type: