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

Warn on empty entrykey (bibtexkey) #4440

Closed
moewew opened this issue Oct 31, 2018 · 5 comments · Fixed by #5025
Closed

Warn on empty entrykey (bibtexkey) #4440

moewew opened this issue Oct 31, 2018 · 5 comments · Fixed by #5025
Labels
entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. integrity-checker ui

Comments

@moewew
Copy link

moewew commented Oct 31, 2018

Small Enhancement

All .bib entries processed by Biber must have a non-empty entrykey. Entries without a key, e.g.

@Book{,
  author  = {Emma Sigfridsson},
  title   = {El book},
  date    = {2012},
  edition = {6},
}

produce an error along the lines of

syntax error: found ",", expected one of: number, name (entry  type, key, field, or macro name), end of entry ("}" or ")") or quoted string 

and the compilation will abort.

biblatex with the BibTeX backend will not error on an empty entrykey, but the entry can not be cited and will not be added to the bibliography even with \nocite{*}.

Classical BibTeX adds entries without key to the bibliography with \nocite{*}, but does not allow to cite them. In any way there can only be one entry with an empty entrykey (after all the key must be unique).

Conclusion: Even though empty entry keys are half possible, they don't quite work as expected and I can't imagine any user choosing an empty key on purpose.

Suggestion JabRef already warns the user directly in the editor view with a little icon if the year field is not a four-digit integer and if it detects journal abbreviations. It seems like a good idea to also warn the user if they leave the entry key empty.


Just to be sure: I tested with JabRef 4.3.1 and did not get an error or a warning about empty keys in the editor view. I also got no report from "Ctrl+F8" on the file

% Encoding: UTF-8

@Book{,
  author  = {Emma Ryde},
  title   = {El book},
  date    = {2010},
  edition = {1},
}

@Comment{jabref-meta: databaseType:biblatex;}

But when I was just playing around with JabRef I saw a message about entrykeys at one point (I can reproduce messages about a key that does not match the automatic pattern, but I could have sworn I also managed to get one about an empty key once, I can't reproduce that one, though), so it seems that some kind of detection is already built-in.


edit: https://tex.stackexchange.com/q/457685/35864 on TeX.SX started this. The OP had an empty entrykey in a JabRef-generated file and was surprised that Biber would report a syntax error.

@Siedlerchr
Copy link
Member

I think there is a setting, which enables the Warning of empty bibtexkeys

@tobiasdiez tobiasdiez added ui integrity-checker entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. labels Oct 31, 2018
@tobiasdiez
Copy link
Member

There is a warning about the empty key in the integrity check. However, the warning message is not shown in the entry editor.

@moewew
Copy link
Author

moewew commented Oct 31, 2018

Oh, I might have overlooked such an option. I have the Enforce legal characters in BibTeX keys option checked, but that does not help with empty keys as far as I can tell (FWIW I don't quite understand what the option does: the quite dangerous Sig,([fri}{dßä\"o:1998)] still passes "Ctrl+F8" and I get no warning icon, but maybe the option is only about auto-generated keys?).

Re the integrity check: I might be missing something obvious. But if I open the file I posted above with JabRef in biblatex mode and press "Ctrl+F8" for the Integrity check, I get "No problems found". That said, as mentioned above I think I managed to get a similar message once, but I now I can consistently reproduce behaviour where I don't get that message.

@ms111ds
Copy link
Contributor

ms111ds commented May 29, 2019

I've been playing around with this issue. Would it be ok to try to help with it?

@Siedlerchr
Copy link
Member

Sure, go ahead! If you need any further help or have questions just ask here or in our gitter chat

tobiasdiez pushed a commit that referenced this issue Jun 9, 2019
* added a warning icon for empty Bibtex keys in entry editor

* fixed formatting issue in FieldCheckers.java

* modified logic and error message in ValidBibtexKeyCheck.checkValue

* Revert "fixed formatting issue in FieldCheckers.java"

This reverts commit 9271562.

* Revert "modified logic and error message in ValidBibtexKeyCheck.checkValue"

This reverts commit bad8856.

* changed status message for empty BibTeX keys to one in localization resources

* ordered class imports alphabetically in FieldCheckers.java

* added entry to CHANGELOG.md for issue #4440

* removed explanation text for issue 4440 fix and updated boolean toggle for empty or null BibTeX keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. integrity-checker ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants