jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Organisations in the bibliography not in alphabetical order

Open 772 opened this issue 1 year ago • 21 comments

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)

  • [x] I made a backup of my libraries before testing the latest development version.
  • [X] 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

772 avatar Sep 07 '24 21:09 772

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

Siedlerchr avatar Sep 07 '24 21:09 Siedlerchr

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

Yeah sure

subhramit avatar Sep 08 '24 03:09 subhramit

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.

subhramit avatar Sep 08 '24 03:09 subhramit

We have a RemoveEnclosingBracesFormatter that can be used

Siedlerchr avatar Sep 08 '24 06:09 Siedlerchr

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.

subhramit avatar Sep 08 '24 14:09 subhramit

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

772 avatar Sep 08 '24 16:09 772

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

koppor avatar Sep 08 '24 16:09 koppor

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 avatar Sep 10 '24 07:09 ryan-carpenter

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.

ryan-carpenter avatar Sep 10 '24 07:09 ryan-carpenter

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.

772 avatar Sep 10 '24 21:09 772

This issue could be related: https://github.com/JabRef/jabref/issues/7805

koppor avatar Dec 09 '24 09:12 koppor

/assign-me

sryjksu avatar Nov 10 '25 02:11 sryjksu

👋 Hey @sryjksu, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! 🚀

github-actions[bot] avatar Nov 10 '25 02:11 github-actions[bot]

⏰ Assignment Reminder

Hi @sryjksu, this is a friendly reminder about your assignment to this issue.

[!WARNING] This issue will be automatically unassigned in 11 days if there's no activity.

Remember that you can ask the JabRef Guru or DeepWiki about anything regarding JabRef. Additionally, our contributing guide has hints on creating a pull request and a link to our Gitter chat.

How to keep your assignment


If you are working on it, you can prevent automatic unassignment by:

  • Submitting a draft pull request with your progress within 11 days
  • Asking for the 📌 Pinned label if you need more time

We appreciate your contribution and are here to help if needed!

github-actions[bot] avatar Nov 19 '25 12:11 github-actions[bot]

📋 Assignment Update

Hi @sryjksu, due to inactivity, you have been unassigned from this issue.

Next steps


If you still want to work on this:

  • Submit a pull request showing your current state. You will be automatically assigned again.
  • Ask a maintainer to assign you again.

github-actions[bot] avatar Nov 30 '25 12:11 github-actions[bot]

/assign-me

sryjksu avatar Dec 03 '25 15:12 sryjksu

⚠️ Reassignment Blocked

Hi @sryjksu, you cannot assign yourself to this issue again.

[!NOTE] Since you were previously unassigned from this issue, a maintainer needs to approve your reassignment.

Please ask a maintainer to assign you if you'd like to continue working on this issue.

jabref-machine avatar Dec 03 '25 15:12 jabref-machine

@koppor I'm still working on this issue for my final project. Could you please assign this issue to me again? Thank you.

sryjksu avatar Dec 03 '25 15:12 sryjksu

👋 Hey @sryjksu, looks like you’re eager to work on this issue — great! 🎉 It also looks like you don't know how to assign issues to yourself. Please read our CONTRIBUTING.md to find out how. It will also guide you in other aspects of contributing to JabRef.

jabref-machine avatar Dec 03 '25 15:12 jabref-machine

@subhramit I saw the instruction said that I need to write unit tests for any modification I make. Since this bug is about UI, how do you want the unit test to be like? Also, do you care about coverage of the tests? If so, what types of coverage?

sryjksu avatar Dec 08 '25 21:12 sryjksu

@subhramit I saw the instruction said that I need to write unit tests for any modification I make. Since this bug is about UI, how do you want the unit test to be like? Also, do you care about coverage of the tests? If so, what types of coverage?

No, unit tests aren't needed for UI changes. Only if there is some change in logic made in the viewmodel, write tests.

subhramit avatar Dec 09 '25 06:12 subhramit