Open 772 opened 2 months ago
@subhramit This is jstyle but as you are deeper in the topic now can you take a look please?
@subhramit This is jstyle but as you are deeper in the topic now can you take a look please?
Yeah sure
As it looks at first sight, the order is overridden because of the curly braces {}. JabRef already stores them in BibTeX format, which has braces around them, so when explicitly added, it becomes {{organization name}}. Instead of "o", the first character to participate in the comparator is then "{".
Solution - we will have to ignore extra braces, if explicitly present. I'll take a look at this.
Temporary workaround - do not use extra braces.
We have a RemoveEnclosingBracesFormatter that can be used
Weirdly enough, I can reproduce with {The Geany contributors} but not {Linux Foundation}. It is as if the issue is occurring in some special case.
Luckily, I have dozens of foundations and companies in my LibreOffice document. :) I think this is the pattern:
If {}-braces are used, JabRef takes the last word within the {}-brackets and sorts it like the ASCII-table. This is why "c" from contributors is above all.
{Linux Foundation} will be sorted in a wrong order, too, if you add two authors with "F" in their last name and "Foundation" is between them.
Edit: The best workaround I found so far is to replace each " " with a rare symbol like "℗". Before finishing your document, you can simply replace all "℗" with " " in LibreOffice.
Two thoughts:
org.jabref.model.entry.BibEntry#getFieldLatexFree
should be used as first try (if it is OK that "The" comes first). However, that ignores authors completelyorg.jabref.model.entry.AuthorList#getAsLastFirstFirstLastNamesWithAnd
or similar method should be used. One needs to look at other methods for sorting...Solution - we will have to ignore extra braces, if explicitly present. I'll take a look at this.
Remember that the braces may be needed to protect the formatting of organisation names, even if the name is only one word.
The best workaround I found so far is to replace each " " with a rare symbol like "℗". Before finishing your document, you can simply replace all "℗" with " " in LibreOffice.
Have you tried using no-break spaces in the organisation names?
The~Geany~contributors
should make the whole name behave as one word (and retain "The" in citation key).
Also, note that (without no-break spaces) capitalisation matters, at least in citation keys. {Linux Foundation}
and {The Geany Contributors}
produce "LinuxFoundation" and "GeanyContributors", respectively in the citation key, but {Linux foundation}
and {The Geany foundation}
produce "Linux" and "Geany". I am not sure if this affects the bibliography.
Have you tried using no-break spaces in the organisation names?
The~Geany~contributors
should make the whole name behave as one word (and retain "The" in citation key).
Yes, it has no effect. When I use The~Geany~contributors
or {The~Geany~contributors}
, the sorting is always wrong. It looks like the "~" is only affecting the display in the JabRef GUI but not text in the LibreOffice document.
JabRef version
5.15 (latest release)
Operating system
GNU / Linux
Details on version and operating system
Fedora 40
Checked with the latest development build (copy version output from About dialog)
Steps to reproduce the behaviour
The bibliography is broken now and not in alphabetical order. Using {}-brackets for organisations was suggested here: https://discourse.jabref.org/t/how-to-enter-corporation-name-in-author-field/2080
Appendix