1.7. 参考文献

Using Sphinx BibTeX extension

Parenthetical referencing can be produced in Sphinx using the sphinxcontrib-bibtex extension.

The sphinxcontrib-bibtex extension allows BibTeX citations to be inserted into documentation generated by Sphinx.

The extension defines a new bibliography directive and a new cite role.

These work similarly to the LaTeX’s thebibliography environment and cite command.

The references are stored in a separate plain text BibTeX format file. Currently, only the unsrt and plain BibTeX styles are supported.

Please note that the current sphinxcontrib-bibtex is a beta version.

Installing the extension The module is installed with:

pip install sphinxcontrib-bibtex

This is a tip.

For Windows users. To facilitate the installation of 3rd party Python packages, follow the instructions on how to add Distribute and Pip to the Python installation .

Including the extension in the project configuration file The Sphinx project conf.py file must be altered to include:

extensions = ['sphinxcontrib.bibtex']

Example In the document, use the following syntax:

See :cite: Strunk1979 for an introduction to stylish blah, blah… And place the directive at the end of the document:

.. bibliography:: references.bib

The references.bib file should contain a BibTex bibliography, including an entry for:

@BOOK{Strunk1979,
title = {The Elements of Style},
publisher = {Macmillan},
year = {1979},
author = {Strunk, Jr., William and E. B. White},
edition = {Third}
}

This documentation can be completed iff required in this specific project.

Using the Sphinx Thesis Resource

See also http://jterrace.github.io/sphinxtr/html/ch-intro/index.html for various useful adaptations/extensions of Sphinx.

1.7.1. 示例:

For the examples above :cite: 1993:PatiOMP , the alpha style citation would be: [BDB79], [BB79a] and [BB79b], respectively.

.. bibliography:: ./refs.bib
   :style: unsrt
   :all: