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

Organisations in the bibliography not in alphabetical order #11725

Open
2 tasks done
772 opened this issue Sep 7, 2024 · 10 comments
Open
2 tasks done

Organisations in the bibliography not in alphabetical order #11725

772 opened this issue Sep 7, 2024 · 10 comments
Labels
bug Confirmed bugs or reports that are very likely to be bugs openoffice/libreoffice

Comments

@772
Copy link

772 commented Sep 7, 2024

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)

  • 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

  1. Set IsSortByPosition="false"
  2. Use "{Linux Foundation}" as an author.

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

grafik

@Siedlerchr
Copy link
Member

@subhramit This is jstyle but as you are deeper in the topic now can you take a look please?

@subhramit
Copy link
Collaborator

@subhramit This is jstyle but as you are deeper in the topic now can you take a look please?

Yeah sure

@subhramit
Copy link
Collaborator

subhramit commented Sep 8, 2024

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.

@Siedlerchr
Copy link
Member

We have a RemoveEnclosingBracesFormatter that can be used

@subhramit
Copy link
Collaborator

image
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.

@772
Copy link
Author

772 commented Sep 8, 2024

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.
grafik

@koppor
Copy link
Member

koppor commented Sep 8, 2024

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 completely
  • org.jabref.model.entry.AuthorList#getAsLastFirstFirstLastNamesWithAnd or similar method should be used. One needs to look at other methods for sorting...

@subhramit subhramit added the bug Confirmed bugs or reports that are very likely to be bugs label Sep 8, 2024
@ryan-carpenter
Copy link

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.

@ryan-carpenter
Copy link

ryan-carpenter commented Sep 10, 2024

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.

@772
Copy link
Author

772 commented Sep 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs openoffice/libreoffice
Projects
Status: Normal priority
Development

No branches or pull requests

5 participants