jabref icon indicating copy to clipboard operation
jabref copied to clipboard

IsSortByPosition ignored

Open vigmond opened this issue 2 years ago • 8 comments

JabRef version

5.11 (latest release)

Operating system

GNU / Linux

Details on version and operating system

OpenSuse 15.4

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. Edit jstyle file so that IsSortByPosition="true"
  2. Generate the bibliography

The bibliography will be alphabetical. Everything else is as expected.

Appendix

jstyle file:

NAME Frontiers Journal Harvard Style

JOURNALS Frontiers

PROPERTIES Title="References" IsSortByPosition="true" IsNumberEntries="false" ReferenceParagraphFormat="Text body" ReferenceHeaderParagraphFormat="Heading 1"

CITATION BibtexKeyCitations="false" AuthorField="author/editor" YearField="year" MaxAuthors="2" MaxAuthorsFirst="2" AuthorSeparator="," AuthorLastSeparator="" AuthorLastSeparatorInText=" and " EtAlString=" et al." YearSeparator=" " InTextYearSeparator=" " BracketBefore="(" BracketAfter=")" BracketBeforeInList="[" BracketAfterInList="] " CitationSeparator=", " UniquefierSeparator="," GroupedNumbersSeparator="-" MinimumGroupingCount="3" FormatCitations="false" CitationCharacterFormat="Default" MultiCiteChronological="true" LAYOUT article=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (\year\uniq). \title, \journal \volume\begin{pages} : \format[FormatPagesForHTML]{\pages}\end{pages}.

book=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author}\begin{editor}\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.)\end{editor}, \year\uniq. \title. \publisher, \address.

incollection=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (\year\uniq). \title. In: \format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.), \booktitle, \publisher.

inbook=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (\year\uniq). \chapter. In: \format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\editor} (Ed.), \title, \publisher.

phdthesis=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (\year\uniq). \title, \school.

default=\format[AuthorLastFirst,AuthorAbbreviator,AuthorAndsReplacer]{\author} (\year\uniq). \title, \journal \volume\begin{pages} : \format[FormatPagesForHTML]{\pages}\end{pages}.

vigmond avatar Nov 23 '23 15:11 vigmond

Hi @vigmond, I would like to work on this issue.

HarikaB11 avatar Nov 24 '23 06:11 HarikaB11

As a general advice for newcomers: check out Contributing for a start. Also, guidelines for setting up a local workspace is worth having a look at.

Feel free to ask here at GitHub, if you have any issue related questions. If you have questions about how to setup your workspace use JabRef's Gitter chat. Try to open a (draft) pull-request early on, so that people can see you are working on the issue and so that they can see the direction the pull request is heading towards. This way, you will likely receive valuable feedback.

github-actions[bot] avatar Nov 24 '23 10:11 github-actions[bot]

@vigmond could you please provide screenshots of prior and expected output?

@HarikaB11 this is not marked as "good first issue". If at any point you feel this is too tough an issue, feel free to check out other issues from the projects page. We are looking forward to transition to CSL styles in LibreOffice/OpenOffice eventually, as there is an organisation behind them that actively maintaines their styles. They also do have a lot more styles.

ThiloteE avatar Nov 24 '23 10:11 ThiloteE

Hi

Here is the screenshot. Note that the references inserted in the libreoffice document are in alphabetical order and not in the order in which they are cited.

Screenshot from 2023-11-24 11-29-43

vigmond avatar Nov 24 '23 10:11 vigmond

The problem was reproduced on a MacBook Pro 14" M2 running Sonoma.

vigmond avatar Nov 26 '23 18:11 vigmond

It works correctly if the in-text citation is a number and not AuthorYear (isNumberEntries=true).

vigmond avatar Dec 04 '23 17:12 vigmond

Sorry but nevermind. It makes little sense to use Author date and then not sort the bibliography by author.

vigmond avatar Dec 04 '23 17:12 vigmond

For some info on the parameters see https://docs.jabref.org/cite/openofficeintegration

Siedlerchr avatar Dec 04 '23 19:12 Siedlerchr

Could anybody give a hint as to where the underlying issue could be? I checked CitationGroups.java and a few other probable places, but could find no issue.

subhramit avatar Mar 23 '24 22:03 subhramit

@subhramit Maybe @antalk2 can share some knowledge from 2022. He rewrote much parts of the code in 2021/2022: https://github.com/JabRef/jabref/pulls?q=is%3Apr+author%3Aantalk2+sort%3Aupdated-desc. No one else touched these parts of JabRef then.

koppor avatar Mar 24 '24 22:03 koppor

There's also some documentation in our devdocs

Siedlerchr avatar Mar 25 '24 05:03 Siedlerchr

Link to the general devdocs regarding LibreOffice integration: https://devdocs.jabref.org/code-howtos/openoffice/

koppor avatar Mar 25 '24 13:03 koppor

I am not sure what knowledge is needed that I could share. Or, what is the problem we are trying to solve.

As vigmond mentioned above: "It makes little sense to use Author date and then not sort the bibliography by author."

Nevertheless, I include pointers below to what I found, just in case.

Docs

According to

doc: https://devdocs.jabref.org/code-howtos/openoffice/overview.html#citation-styles src: https://github.com/JabRef/jabref/blob/9116477440218d4c0aafdf95fa64cbbbf379fa63/docs/code-howtos/openoffice/overview.md?plain=1#L120

four styles are supported:

  • (1) jstyle:BibTeXKeyCitations
  • (2) Citations numbered in order of first appearance (jstyle:IsSortByPosition)
  • (3) Citations numbered according to their order in the sorted bibliography
  • (4) Author-year styles

(It is not spelled out above, but I believe (3) sorts as Author-year, and numbers the citations accordingly.)

Maybe the user documentation

  • https://docs.jabref.org/cite/openofficeintegration#the-style-file
  • or the description of IsSortByPosition https://docs.jabref.org/cite/openofficeintegration#global-properties could be extended to clarify the situation for users.

Technical background

I think (but could not test now), I did not change this aspect.

  • The accessor to jstyle:IsSortByPosition in the code: https://github.com/JabRef/jabref/blob/9818ba82117da912fad0e80ac6a905521618597d/src/main/java/org/jabref/logic/openoffice/style/OOBibStyle.java#L463

  • It is used in a single location, in OOProcessNumericMarkers::produceCitationMarkers() https://github.com/JabRef/jabref/blob/9818ba82117da912fad0e80ac6a905521618597d/src/main/java/org/jabref/logic/openoffice/style/OOProcessNumericMarkers.java#L28

In particular: https://github.com/JabRef/jabref/blob/20e1e6ac2a7ee568d85dff7542dc6bec65730d4b/src/main/java/org/jabref/logic/openoffice/style/OOProcessAuthorYearMarkers.java#L129

calls https://github.com/JabRef/jabref/blob/20e1e6ac2a7ee568d85dff7542dc6bec65730d4b/src/main/java/org/jabref/logic/openoffice/style/OOProcessAuthorYearMarkers.java#L138

unconditionally.

antalk2 avatar Mar 25 '24 14:03 antalk2

@antalk2 Thank you so much for taking your time to help here. This should a bit guide newcomers to the code!

@vigmond Reading your comment and the comment by @antalk2, it seems, we just need to close issue, because it is a no-issue. - If I am mistaken, please comment here.

koppor avatar Mar 25 '24 14:03 koppor