• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    Python
  • License
    Other
  • Created over 12 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sphinx extension for bibtex style references.

sphinxcontrib-bibtex

ci codecov latest version license

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.

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].

[1](1, 2) Edward Nelson. Radically Elementary Probability Theory. Princeton University Press, 1987.

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.

More Repositories

1

inipp

Simple C++ ini parser.
C++
270
star
2

ffmpeg-msvc-build

Script for building ffmpeg with msvc.
CMake
73
star
3

pycddlib

A Python wrapper for Komei Fukuda's cddlib.
Python
58
star
4

latexcodec

Lexer and codec to work with LaTeX code in Python. Instead of using latexcodec, I encourage you to consider pylatexenc instead, which is far superior: https://github.com/phfaist/pylatexenc
Python
27
star
5

cddlib_old

Please refer to the official version of cddlib on github instead.
Mathematica
13
star
6

improb

A Python module for working with imprecise probabilities.
Python
10
star
7

ffmpeg-nuget

As of October 1st 2020, this repository will no longer receive any updates, since zeranoe is closing and will no longer be providing any builds. Visual Studio has nowadays excellent integration with vcpkg. Pre-built vcpkg archives are available from ffmpeg-msvc-build, or simply build ffmpeg yourself using vcpkg.
PowerShell
8
star
8

agda-proofs

Agda
4
star
9

AgdaTutorial

Git fork of http://hub.darcs.net/divip/AgdaTutorial
Agda
4
star
10

gta5-simple-video-export

For quick experimentation only.
C++
3
star
11

bibliography

My bibtex bibliography.
TeX
3
star
12

quickrest

Quick restructured text creator.
Python
2
star
13

x264-msvc-build

Visual Studio builds of x264. This repository is no longer maintained. If you are looking to build x264, you may look into vcpkg instead.
Shell
2
star
14

sphinx-citation-invalid-html

1
star
15

kbtune

Keyboard tuning calculator.
Python
1
star
16

homepage

My homepage.
Haskell
1
star
17

config-openbox

My openbox configuration.
Shell
1
star
18

xresources

My .Xresources file.
Emacs Lisp
1
star
19

ffmpeg-msvc-nuget

As of October 1st 2020 onward, this repository will no longer receive any updates, since Visual Studio has nowadays excellent integration with vcpkg. Pre-built vcpkg archives are available from ffmpeg-msvc-build, or simply build ffmpeg yourself using vcpkg.
PowerShell
1
star
20

pybtex-docutils

A docutils backend for pybtex.
Python
1
star
21

sipta-school-2024-decision-notebooks

Jupyter notebooks for the SIPTA school 2024 lectures on decision making.
Jupyter Notebook
1
star