Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bibtex bibliography directive renders unreferenced citation #95

Closed
mtiley opened this issue Mar 2, 2020 · 4 comments
Closed

Bibtex bibliography directive renders unreferenced citation #95

mtiley opened this issue Mar 2, 2020 · 4 comments
Labels
bug Something isn't working more-info-required More information is required to fix the issue

Comments

@mtiley
Copy link

mtiley commented Mar 2, 2020

This happens when there are user errors in the {cite} roles in the document (specifically, reference to something not in the .bib)

To Reproduce

  1. {cite} something that is not in reference.bib
  2. put in a {bibliography}
  3. observe that the bibliography contains references not cited in the document

Edit: Sorry, this is wrong. Another instance here with different cause.

Screenshots
Here is a citation with no corresponding entry in references.bib
refin
The bibliography outputs a different reference:
refout

(This doesn't happen with rST and seems to be introduced by myst_parser. The following is in a separate Sphinx project with only sphinxcontrib.bibtex as an extension.) See input:
bib1

html output:
bib2

Environment:

  • myst-parser 0.2.0
  • sphinxcontrib.bibtex 1.0.0
@mmcky
Copy link
Member

mmcky commented Mar 10, 2020

@mtiley is the incorrect reference resolving to the nearest reference in the references.bib file? It is an issue that the incorrect reference is getting adding rather than throwing an error that it cannot resolve the reference. This is likely a sphinx translator issue? @chrisjsewell is the AST correct for the parser?

@mtiley
Copy link
Author

mtiley commented Mar 10, 2020

@mmcky I don't think so -- Yuna will be doing some more testing tomorrow.

This is the .bib file I was using (had to change to .txt to upload): references.txt

@mtiley
Copy link
Author

mtiley commented Mar 12, 2020

Update: I have replicated the problem in a project (files here) without myst-parser (only sphinxcontrib.bibtex) as an extension. Seems to be an issue with (or feature of) sphinxcontrib-bibtex and not introduced by myst-parser after all -- so I think this issue can be closed.

Discussion here mcmtroffaes/sphinxcontrib-bibtex#62 and here mcmtroffaes/sphinxcontrib-bibtex#52

The problem appears to be fixed in rST by adding a :filter: docname in docnames option to the bibliography directive so that only citations in that particular document appear in the bibliography. I can't get this to work in MyST at the moment but will play around with it a bit more.

@chrisjsewell
Copy link
Member

@mtiley ok I'll close this issue for now then, and if you do uncover a discrepancy, please open another issue and, if possible, a PR with a minimal working example; in a similar fashion to what I did in #97 (adding to https://github.com/ExecutableBookProject/MyST-Parser/tree/master/tests/test_sphinx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more-info-required More information is required to fix the issue
Projects
None yet
Development

No branches or pull requests

3 participants