2.11. 引文Citations

2.11.1. 使用Sphinx引文

第一种,使用 Sphinx 引文方式。

引用和脚注是一样的,只不过引用只能用文本而不能用数字。

示例如下:

引用参考的内容通常放在页面结尾处,比如 [One]_,Two_

.. [One] 参考引用一
.. [Two] 参考引用二

效果如下:

引用参考的内容通常放在页面结尾处,比如 [One][Two]

[One]

参考引用一

[Two]

参考引用二

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

BiDB79

References

[BDB79]

Biskup, J.; Dayal, U.; Bernstein, P.A..: Synthesizing independent database schemas. In: ACM SIGMOD 1979 Int. Conf. On Management of Data Proceedings, S. 143-151.

[BB79a]

Beeri, C.; Bernstein, P.A.: Computational problems related to the design of normal relational schemas. ACM Trans. Database Syst., No. 1, 1979, S. 30-59.

[BB79b]

Beeri, C.; Bernstein, P.A.: Computers are stupid. ACM Trans. Database Syst., No. 4, 1979, S. 253-266.

2.11.2. 使用BibTeX扩展

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.

示例:

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

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