nzhagen / bibulous

Bibulous - a simple drop-in replacement for BibTeX
MIT License
47 stars 9 forks source link

Incorrect reference numbering when using \nocite{*} #17

Closed engeljh closed 4 years ago

engeljh commented 4 years ago

When I use \nocite{*} the list of references starts at number 2. Here is a minimal example:

test.tex:

\documentclass{article} \begin{document} \nocite{*} \bibliographystyle{test} \bibliography{test} \end{document}

test.bib:

@article{a, author = "Author, A.", title = "Title A", } @article{b, author = "Author, B.", title = "Title B." }

test.bst:

@article{a, author = "Author, A.", title = "Title A", } @article{b, author = "Author, B.", title = "Title B." }

Resulting test.bbl:

\begin{thebibliography}{2} \providecommand{\enquote}[1]{``#1''} \providecommand{\url}[1]{{\tt #1}} \providecommand{\href}[2]{#2}

\bibitem[2]{a} A. Author, Title A

\bibitem[3]{b} B. Author, Title B.

\end{thebibliography}

nzhagen commented 4 years ago

I see your "test.bst" is just a copy of your "test.bib", but that is just a copy-paste error, I think. So I replaced it with a default BST file and tried your example -- and yes, I get the same result that you do. The numbering is off by one. I will see if I can find the error.

engeljh commented 4 years ago

Oh yes, I'm sorry. In case you're curious, test.bst contains just the line "article = , "</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/nzhagen"><img src="https://avatars.githubusercontent.com/u/3494577?v=4" />nzhagen</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>That really is an annoying error. Poking around a bit, I can see that it is not actually an error with Bibulous itself, but somehow with the interaction between the LaTeX frontend and the bibliography engine backend. The reason I say this is that the error occurs in the <em>.aux file, which is generated by LaTeX. Since Bibulous is only a back-end engine, it simply takes what LaTeX instructions are delivered and re-formats them into reference list. Since LaTeX says that the list starts at 2, Bibulous just follows along, quite naturally. However, if I switch the bibliography engine to BibTeX, then the </em>.aux file changes, and now numbers starting at 1. Thus, there seems to be some hidden interaction between the back-end BibTeX and front-end LaTeX that is missing when using Bibulous. I've never had the patience to dive into LaTeX code and so am not well situated to seeing what is going on here. Does anyone else out there have ideas?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/engeljh"><img src="https://avatars.githubusercontent.com/u/49688723?v=4" />engeljh</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Hi,</p> <p>When I run my minimal example, the file test. aux looks like this:</p> <p>\relax \citation{*} \bibstyle{test} \bibdata{test}</p> <p>How is the problem there? It's only the bbl file that seems to me to get messed up. Am I missing something?</p> <p>P.S. Bibulous is a great and really useful project</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/nzhagen"><img src="https://avatars.githubusercontent.com/u/3494577?v=4" />nzhagen</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Hmm, there is a clue there. My own test.aux file is</p> <p>\relax \citation{*} \bibstyle{test} \bibdata{test} \bibcite{a}{2} \bibcite{b}{3}</p> <p>However, if I remove the last two lines and re-run Bibulous, I get the same result. This gives me a better idea of where the error may be coming from. I will do some more hunting... Thanks!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/nzhagen"><img src="https://avatars.githubusercontent.com/u/3494577?v=4" />nzhagen</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>I found the error and uploaded the new code to the repo. The offending code was at line 362, where I had</p> <p>self.citedict[key] = i+1</p> <p>but this should be </p> <p>self.citedict[key] = i</p> <p>The updated repo has the fix included, but I see that updates to my Python environment have caused a number of errors in the testing suite related to locale-based sorting and UTF8 encoding. I will open a new issue on getting those fixed. But I think this one is fixed and can be closed.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/engeljh"><img src="https://avatars.githubusercontent.com/u/49688723?v=4" />engeljh</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Thank you! And yes, UTF8 encoding was also giving me trouble.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/nzhagen"><img src="https://avatars.githubusercontent.com/u/3494577?v=4" />nzhagen</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>engeljh,</p> <p>I've been working on UTF8 issues and now have the testing suite running with all tests passing. This has been uploaded to the GitHub repo. However, you mentioned that you had experienced some UTF8 issues. Would you mind posting another issue on the Bibulous sourcecode site and I could look into what might be causing the problems you're having?</p> <p>Thanks again for posting your earlier issue, and for helping me figure out the source of that problem.</p> <ul> <li>Nathan</li> </ul> <p>On Fri, Feb 14, 2020 at 12:53 PM engeljh <a href="mailto:notifications@github.com">notifications@github.com</a> wrote:</p> <blockquote> <p>Thank you! And yes, UTF8 encoding was also giving me trouble.</p> <p>— You are receiving this because you commented. Reply to this email directly, view it on GitHub <a href="https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AA2VFMLUQ4GPY3UZAC2VU5LRCYIUZA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELXPKPI#issuecomment-586085693">https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AA2VFMLUQ4GPY3UZAC2VU5LRCYIUZA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELXPKPI#issuecomment-586085693</a>, or unsubscribe <a href="https://github.com/notifications/unsubscribe-auth/AA2VFMJFYGSCZB732UYLS3TRCYIUZANCNFSM4KQ7HPUQ">https://github.com/notifications/unsubscribe-auth/AA2VFMJFYGSCZB732UYLS3TRCYIUZANCNFSM4KQ7HPUQ</a> .</p> </blockquote> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/engeljh"><img src="https://avatars.githubusercontent.com/u/49688723?v=4" />engeljh</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Hello,</p> <p>Sorry to take so long responding to this. Actually, I don't really know whether the issues involved UTF-8. All I know is that I had to eliminate all the non-ascii characters from my bibliography in order for bibulous to process it. Is that something I should open an issue about? If so, I can give a minimal example.</p> <p>Jon</p> <hr /> <p>From: nh <a href="mailto:notifications@github.com">notifications@github.com</a> Sent: Monday, February 17, 2020 2:08 AM To: nzhagen/bibulous <a href="mailto:bibulous@noreply.github.com">bibulous@noreply.github.com</a> Cc: Engel, Jonathan <a href="mailto:engelj@physics.unc.edu">engelj@physics.unc.edu</a>; Author <a href="mailto:author@noreply.github.com">author@noreply.github.com</a> Subject: Re: [nzhagen/bibulous] Incorrect reference numbering when using \nocite{*} (#17)</p> <p>engeljh,</p> <p>I've been working on UTF8 issues and now have the testing suite running with all tests passing. This has been uploaded to the GitHub repo. However, you mentioned that you had experienced some UTF8 issues. Would you mind posting another issue on the Bibulous sourcecode site and I could look into what might be causing the problems you're having?</p> <p>Thanks again for posting your earlier issue, and for helping me figure out the source of that problem.</p> <ul> <li>Nathan</li> </ul> <p>On Fri, Feb 14, 2020 at 12:53 PM engeljh <a href="mailto:notifications@github.com">notifications@github.com</a> wrote:</p> <blockquote> <p>Thank you! And yes, UTF8 encoding was also giving me trouble.</p> <p>— You are receiving this because you commented. Reply to this email directly, view it on GitHub <a href="https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AA2VFMLUQ4GPY3UZAC2VU5LRCYIUZA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELXPKPI#issuecomment-586085693">https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AA2VFMLUQ4GPY3UZAC2VU5LRCYIUZA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELXPKPI#issuecomment-586085693</a>, or unsubscribe <a href="https://github.com/notifications/unsubscribe-auth/AA2VFMJFYGSCZB732UYLS3TRCYIUZANCNFSM4KQ7HPUQ">https://github.com/notifications/unsubscribe-auth/AA2VFMJFYGSCZB732UYLS3TRCYIUZANCNFSM4KQ7HPUQ</a> .</p> </blockquote> <p>— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<a href="https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AL3DBEYGOIVHWWWIFNQ37U3RDIZXDA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL5JJXQ#issuecomment-586847454">https://github.com/nzhagen/bibulous/issues/17?email_source=notifications&email_token=AL3DBEYGOIVHWWWIFNQ37U3RDIZXDA5CNFSM4KQ7HPU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL5JJXQ#issuecomment-586847454</a>, or unsubscribe<a href="https://github.com/notifications/unsubscribe-auth/AL3DBE5G4GN7PIM7S2C7HA3RDIZXDANCNFSM4KQ7HPUQ">https://github.com/notifications/unsubscribe-auth/AL3DBE5G4GN7PIM7S2C7HA3RDIZXDANCNFSM4KQ7HPUQ</a>.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/nzhagen"><img src="https://avatars.githubusercontent.com/u/3494577?v=4" />nzhagen</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Ah, that sounds familiar. I have exactly the same problem, but I don't think it is due to Bibulous. For example, if I have UTF8-encoded characters in the .bib file and use LuaLaTeX and Bibulous then I have no problem. If I compile using regular LaTeX and Bibulous, then I get garbage for those characters. So I think it is likely a problem with the TeX base code rather than Bibulous. But if you find that Bibulous is at fault, let me know and I'll start hunting for the problem.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>