I'm creating a documentation for a Python package and I started to use Sphinx to generate it (using autodoc extension). To enriched it, I'm also using the MyST extension. I'm facing a minor issue trying to include citations. I want to use a Bibtex file so I added the sphinxcontrib.bibtex to my conf.py, I use the role {cite:t}`my_citation` everything is working fine but the citation does not include the year of publication. I tried different bibtex_default_style (the ones given in the documentation: alpha, unrst, plain) but the year is never displayed.
./doc/source/conf.py# -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration extensions = ['myst_nb', 'sphinx.ext.autodoc', 'sphinxcontrib.bibtex'] templates_path = ['_templates'] exclude_patterns = [] bibtex_bibfiles = ["references.bib"] bibtex_default_style = 'plain' # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = 'sphinx_book_theme' html_static_path = ['_static']./doc/source/references.bib@article{knuth:1984, title={Literate Programming}, author={Donald E. Knuth}, journal={The Computer Journal}, volume={27}, number={2}, pages={97--111}, year={1984}, publisher={Oxford University Press} }./doc/source/my_chapter.md# Section I want to cite {cite:t}`knuth:1984`. --- **Bibliography** ```{bibliography} ```
Result:
Section
I want to cite Knuth [1]
Bibliography
[1] Donald E. Knuth. Literate programming. The Computer Journal, 27(2):97–111, 1984.