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

Incorrect bibkey creation for >4 authors #11087

Closed
2 tasks done
umuen opened this issue Mar 24, 2024 · 17 comments · Fixed by #11105
Closed
2 tasks done

Incorrect bibkey creation for >4 authors #11087

umuen opened this issue Mar 24, 2024 · 17 comments · Fixed by #11105
Assignees
Labels
bib(la)tex bug Confirmed bugs or reports that are very likely to be bugs keygenerator

Comments

@umuen
Copy link

umuen commented Mar 24, 2024

JabRef version

5.12 (latest release)

Operating system

macOS

Details on version and operating system

MacOS Ventura 13.6.5 (22G621)

Checked with the latest development build (copy version output from About dialog)

  • I made a backup of my libraries before testing the latest development version.
  • I have tested the latest development version and the problem persists

Steps to reproduce the behaviour

When using the Citation Key Generator specification: [authIni4][year][journal:abbr:lower] it works as it should for 1, 2, 3 or 4 authors. However, if there are more than 4 authors it only uses the first THREE initials but not the first FOUR as it should. I was not able to check with the newest build as Apple does not allow me to open it (and I had to tick the boxes to be able to submit the report - sort of a catch 22)

Appendix

...

Log File
Paste an excerpt of your log file here
@Siedlerchr
Copy link
Member

@umuen To run the newest development build you have run it first then allow it in settings under data protection and security (Make sure to pick the right one for your OS M1/m1 - arm64 suffix

@umuen
Copy link
Author

umuen commented Mar 24, 2024

thanks for the info. I tested it and the issue is still there in the most recent build

@github-project-automation github-project-automation bot moved this to Normal priority in Prioritization Mar 24, 2024
@Siedlerchr Siedlerchr added the bug Confirmed bugs or reports that are very likely to be bugs label Mar 24, 2024
@LoayGhreeb
Copy link
Collaborator

LoayGhreeb commented Mar 24, 2024

@Siedlerchr, it seems the issue is related to PR #9703.

We changed the handling of an "overflow" of authors at [authIniN]: JabRef uses + to indicate an overflow. For example, [authIni2] produces A+ (instead of AB) for Aachen and Berlin and Chemnitz.

However, I would like to know where this + appears and why this feature was added.

final boolean lastAuthorIsOthers = authorList.getAuthor(numberOfAuthors - 1).equals(Author.OTHERS);
if ((n > 1) && ((n < numberOfAuthors) || lastAuthorIsOthers)) {
final int limit = Math.min(n - 1, numberOfAuthors - 1);
// special handling if the last author is "Others"
// This gets the single char "+" only
AuthorList allButOthers = AuthorList.of(
authorList.getAuthors()
.stream()
.limit(limit)
.toList());
return authIniN(allButOthers, n - 1) + "+";
}

@koppor
Copy link
Member

koppor commented Mar 24, 2024

@umuen Thank you so much for your report. I checked the documentation at https://docs.jabref.org/setup/citationkeypatterns#author-related-field-markers. It reads

The beginning of each author's last name, using at most N characters in total.

First, I thought, we should introduce [authIni4+] with the semantics to show the first 4 lastnames (and thereof the first letter), and then adding a + if there are more than four. However, this is maybe unneeded.

Thus, we should change the logic to contain 4 letters. The only "exception" is "and others" - this is rendered as "+". Meaning:

Aachen and Berlin and Chemnitz and others

Gets

ABC+

(and not ABCo or something else weird stuff)

@koppor
Copy link
Member

koppor commented Mar 24, 2024

@LoayGhreeb Typically + is used for saying "and more". In BibTeX terms and others. In BibTeX, one can explicitly write and others. This is a fixed term. Defined by BibTeX. Nothing we can change. Need to accept that. - JabRef could not handle "and others". It thought "others" be a name instead of an indicator for "and more". Therefore the issue JabRef#626. -- The fix for the isuse here is to distinguish and others with "more names" exist. Example:

Aachen and Berlin and Chemnitz and Düsseldorf and Essen

should lead to

ABCD

but

Aachen and Berlin and Chemnitz and others

should lead to

ABC+

@Siedlerchr
Copy link
Member

@umuen Could you give us a sample entry where this occured?

@umuen
Copy link
Author

umuen commented Mar 24, 2024

Below is an example where it should give "GAHS2023jpcc" but gives "GAH2023jpcc". I would like to point out that the behaviour was correct up to some weeks/months ago (I am not sure up to when exactly), i.e., for greater equal 4 authors only the initials of the first authors are used (without a "+" or similar). This is how my large bibfile is structured and is used in citations in many documents. It would be most unfortunate if the behaviour remains changed. Thanks for looking into this.

@Article{GAHS2023jpcc,
  author   = {Golomb, M. and Arndt, N. B. and Honnigfort, C. and Shakhayeva, B. and Ravoo, B. J. and Braunschweig, B.},
  journal  = {J. Phys. Chem. C},
  title    = {Molecular kinetics and wetting dynamics of self-assembled monolayers with fluorinated arylazopyrazoles},
  year     = {2023},
  pages    = {15316--15325},
  volume   = {127},
	  doi      = {10.1021/acs.jpcc.3c02472},
}

@koppor
Copy link
Member

koppor commented Mar 24, 2024

@LoayGhreeb May I assign you? I can also put that as small university project.

@LoayGhreeb
Copy link
Collaborator

Typically + is used for saying "and more". In BibTeX terms and others. In BibTeX, one can explicitly write and others.

I understand this, but where does the + sign actually appear?
If I set the Citation Key Generator to use [authIni2] in the preferences, an entry with author = {Aachen and Berlin and others}
results in the generated citation key being A instead of A+.

My question is not about the "and others" being replaced with '+'. In PR #9703, there are two changelog entries. The first one is:

We changed the handling of an "overflow" of authors at [authIniN]: JabRef uses + to indicate an overflow. Example: [authIni2] produces A+ (instead of AB) for Aachen and Berlin and Chemnitz.

This is what I'm asking about. Why is this done?

May I assign you? I can also put that as small university project.

Sure.

@koppor
Copy link
Member

koppor commented Mar 25, 2024

I understand this, but where does the + sign actually appear? If I set the Citation Key Generator to use [authIni2] in the preferences, an entry with author = {Aachen and Berlin and others} results in the generated citation key being A instead of A+.

I see that, too.

Think, this is a bug.

We changed the handling of an "overflow" of authors at [authIniN]: JabRef uses + to indicate an overflow. Example: [authIni2] produces A+ (instead of AB) for Aachen and Berlin and Chemnitz.

As discussed above. This is wrong. The result has to be "AB".

Code needs to be fixed.

@Siedlerchr
Copy link
Member

It's simply a off-by-one error here.

@koppor
Copy link
Member

koppor commented Mar 25, 2024

It's simply a off-by-one error here.

No. See org.jabref.logic.citationkeypattern.BracketedPatternTest#authIni4()

Currently:

Arguments.of("ABC+", "Aachen and Berlin and Chemnitz and Düsseldorf and Essen"),

But it should be

Arguments.of("ABCD", "Aachen and Berlin and Chemnitz and Düsseldorf and Essen"),

@LoayGhreeb
Copy link
Collaborator

Just to confirm, is this the correct for [authIni4]?

Arguments.of("Aac+", "Aachen and others"),

Arguments.of("ABCD", "Aachen and Berlin and Chemnitz and Düsseldorf and others"), // No need for the `+`?

@umuen
Copy link
Author

umuen commented Mar 26, 2024 via email

@koppor
Copy link
Member

koppor commented Mar 26, 2024

I agree! @LoayGhreeb

@LoayGhreeb
Copy link
Collaborator

@umuen You can use the latest development version, the issue should be resolved.

Also, if you are using and others, and the + sign is supposed to be used but it is not visible, open Preferences → Citation Key Generator → and remove the + from the "Remove the following characters" filed.

@umuen
Copy link
Author

umuen commented Mar 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bib(la)tex bug Confirmed bugs or reports that are very likely to be bugs keygenerator
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants