mcmtroffaes / sphinxcontrib-bibtex

Sphinx extension for bibtex style references.
Other
181 stars 45 forks source link

Citation style does not change citation rendering #253

Closed padix-key closed 3 years ago

padix-key commented 3 years ago

Neither the bibtex_default_style variable nor the :style: value seems to have an effect on how a citation is rendered. It is always rendered in this style, although I tried all four supported citation styles:

Johann Gasteiger and Mario Marsili. Iterative partial equalization of orbital electronegativity—a rapid access to atomic charges. Tetrahedron, 36(22):3219–3228, January 1980. URL: https://www.sciencedirect.com/science/article/pii/0040402080801682 (visited on 2021-06-10), doi:10.1016/0040-4020(80)80168-2.

I am using sphinxcontrib-bibtex 2.3.0

mcmtroffaes commented 3 years ago

Thanks for reporting. The different styles seem to be working alright in the test suite, so currently I cannot pinpoint the cause of the problem. Do you have a simple test case to allow me to reproduce the problem?

padix-key commented 3 years ago

https://gist.github.com/padix-key/0f77d6b437a447b645b52dd0e7e91d6f

When i change bibtex_default_style and run sphinx_build again the citation does not change.

mcmtroffaes commented 3 years ago

Thanks for the example. The standard styles only differ in the labels (which is irrelevant for footcite roles), and in sorting (which is also irrelevant for footcite roles, these are inserted in order of occurrence in the document as with other footnotes). So yes, you should be seeing exactly the same. Could you clarify what you are expecting to see with each style?

padix-key commented 3 years ago

Thank you, I expected that the citations are rendered in different ways and I wanted to check which one looks most appealing. I did not know that all styles are basically equal. Do you plan to support further citation styles, for example IEEE?

mcmtroffaes commented 3 years ago

Thanks for confirming. All seems well then. I've added a note about the labelling and sorting of footnote citations in the documentation, so your report has been helpful to improve the documentation.

And indeed, all builtin styles currently are identical except for labelling and sorting. The styles come from pybtex, and you can easily create your own to get the desired effect. I'm not intending to keep a repository of pybtex styles with this extension. However, nothing stops anyone from developing their own and registering them with pybtex's plugin system. For more information, see:

https://sphinxcontrib-bibtex.readthedocs.io/en/latest/usage.html#custom-formatting-sorting-and-labelling https://docs.pybtex.org/api/styles.html#style-api