andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
85 stars 9 forks source link

citeproc-bt--to-csl-names: Args out of range: "", 0, 1 #79

Closed Ossifragus closed 2 years ago

Ossifragus commented 2 years ago

The recent update to 20211127.936 does not work and gives the following error:

citeproc-bt--to-csl-names: Args out of range: "", 0, 1

Here is a minimal working example

#+bibliography: ~/Dropbox/mydoc/CV/papers.bib
#+cite_export: csl ~/Dropbox/mydoc/web/style/APA-CV.csl
[cite:@paper2021]
andras-simonyi commented 2 years ago

Thanks for the report! I've pushed a commit which should fix the problem, but it would be useful if you could post the offending entry (paper2021) as well -- my guess is that it contains a not entirely well formed name field.

Ossifragus commented 2 years ago

Thank you very much for your prompt response. The problem is fixed. The entry in the example is below. Are these empty entries, e.g., pages and editor causing the problem? I tried to replace \textbf{Wang, H.} with Wang, H., and this does not seem to be the reason.

@InProceedings{paper2021,
  title =    {Nonuniform Negative Sampling and Log Odds Correction with Rare Events Data},
    author           = {\textbf{Wang, H.} and Zhang, Aonan and Wang, Chong},
  booktitle =    {Proceedings of The 35 Conference on Neural Information Processing Systems (NeurIPS 2021).},
  pages =    {},
  year =     {2021},
  editor =   {},
  volume =   {},
  series =   {Proceedings of Machine Learning Research},
  publisher =    {PMLR},
}
bdarcus commented 2 years ago

I don't think that should be a problem; I ran your example through bibtools and bibutils and neither complained about any error, or yielded unexpected results.

andras-simonyi commented 2 years ago

Well, the code in citeproc-el assumed that there are no empty fields in the entries but apparently this is a thing (BTW, are there tools that actually create such fields?) so I added a filter to the bibtex->CSL converter which simply removes them. Hopefully this resolves the issue.

bdarcus commented 2 years ago

I assume some GUI apps do.

But bibutils, for example, strips them.

Ossifragus commented 2 years ago

Well, the code in citeproc-el assumed that there are no empty fields in the entries but apparently this is a thing (BTW, are there tools that actually create such fields?) so I added a filter to the bibtex->CSL converter which simply removes them. Hopefully this resolves the issue.

Yes, the issue is resolved. Many thanks again. I often use BibTeX-Mode to insert a template and then edit each key. Sometime I need to update certain keys later so I just leave them empty (probably a bad habit).

Ossifragus commented 2 years ago

bibutils

Thank you for pointing out bibutils. I never used it before but will check it out.