Sphinxcontrib-bibtex is a Sphinx extension that enables BibTeX-style citations in documentation. It allows users to insert citations via roles like `:cite:p:` and `:cite:t:` and generate bibliographies using a `.. bibliography::` directive, similar to LaTeX's `thebibliography` environment. The library is currently at version 2.6.5 and maintains an active development and release cadence.
pip install sphinxcontrib-bibtexVerified import paths — ran on the pinned version, not inferred.
To quickly set up `sphinxcontrib-bibtex`, first install it via pip. Then, modify your `conf.py` to add `'sphinxcontrib.bibtex'` to your `extensions` list and specify your BibTeX files using `bibtex_bibfiles`. Create a `.bib` file (e.g., `refs.bib`) with your entries. Finally, use `:cite:t:` (textual), `:cite:p:` (parenthetical) roles, and the `.. bibliography::` directive in your reStructuredText files to cite and display your references.
Upgrade your Sphinx installation to version 3.5 or higher (`pip install 'Sphinx>=3.5'`).
Upgrade your Python environment to Python 3.9 or a newer supported version.
Ensure `docutils` is not version 0.18 or 0.19. The `pyproject.toml` specifies `docutils>=0.8,!=0.18.*,!=0.19.*`.
Always define `bibtex_bibfiles = ['your_file.bib']` (or a list of files) in your `conf.py`.
For enhanced citation styling and new features, upgrade to `sphinxcontrib-bibtex` 2.2.0 or newer and use the specific `cite:t:` and `cite:p:` roles.
Ensure that `pip install sphinxcontrib-bibtex` is run in the same Python environment that is used to execute `sphinx-build`. Verify with `which python` and `which sphinx-build`.