-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fix generation of multiple bibliography sections #12309
base: main
Are you sure you want to change the base?
Conversation
This will just make existing CSL style usage in the document obsolete? |
Unless the style is switched back to it. Then, the existing CSL citations will be parsed again, so not completely obsolete, but if never switched back - yes (since they have a different reference mark format). Same is true for JStyle usage being turned obsolete. |
This gives the idea - there is a way to take into account all the entries present - but for that we will need to change the reference mark format of jstyles so that they can be parsed together with CSL as well - so the bibliography section will have all references in the currently selected style, regardless of the citations having different style families. |
Further unification possible - on switching style families, the citations should also be modified into the current style (which currently happens "within" style families). This one's a good project, but depends on how useful this will be. |
Decision on whether or not to merge this one remains for now. Two bibliography sectionsWorkaround - delete the old section, re-cite the old entries with the new style along with the new entries and refresh bibliography. One bibliography section with only fresh entriesWorkaround - re-cite the old entries with the new style along with the new entries, then refresh bibliography. |
Please not. One bibliography. The style should not trigger which entries are part of some bibliography. As user, I choose a style, and that style should be used throughout the paper - especially the bibliogrgraphy. |
Is this the chance to convert all references to the Zotero format? Now that you are learning about identifiers in other programs, chances are high that another identifier format can be used? |
@koppor this will be a long one, read when you have time. Current focus
That would make the merging of this PR relevant. The issue that would remain is:
With only this PR, this would be considered the responsibility of a user to choose one style type/"family" (CSL or JStyle) uniformly throughout the paper (that is how these styles are supposed to be used anyway - even within a style family, the user should use one style consistently). But then one may argue that if that is properly done by the user, there will not be two bibliography sections in the first place. If the user messes up and realizes that they had to use another style family (hopefully, the user detects such an obvious error very early into his work looking at the citations or the bibliography), they have a simple enough workaround as I mentioned above: re-cite the old entries too with the new style, then refresh bibliography. If we want JabRef to take care of it, we have to unify the reference mark format, hence have to take a decision - whether to migrate CSL to JStyle format (this is not too hard, as I haven't lost context of the classes I wrote - will have to change the structure of assignment and parsing in The other option would be migration of JStyle to the CSL format - this would be hard and a lot more time taking as the code there is very different with hard to navigate logic and dependencies. The other part
I learnt about identifiers in other programs when I was taking a decision on what to choose for JabRef's CSL integration back during GSoC itself. That's why, the format we use for CSL is very similar to: There are differences, such as:
But wait, these still seem pretty easy to change - where's the catch?It is how we identify the entries. We use their citation keys. This is generated in a particular way, which can differ from software to software. In case of Zotero, I haven't been able to expand the reference mark, bit it appears to me as if Zotero doesn't use citation keys to identify: They use a JSON format, with the first field being the "citationID", which, on inspection, cannot be a citation key as it begins with a small "w" (no field of the entry has that). I tried searching the code for "citationId" but didn't find any results. Maybe this can be a GSoC project this year? |
I did not pay attention to the development of JSTyle and GSoC, because I thought following is obvious:
In step 6, the switch from style A to style B is a one-line change (values are example values) -\bibliographystyle{plain}
+\bibliographystyle{IEEEtranN} This is the main use case! - Everything else is an addon. Addons are for example: Bibliography per chapter, The main use case has to work. Other use cases have lower priority. With "work" I mean, I should be a single action of the user to change the style. |
Got it. Hadn't considered this. @ThiloteE had suggested that one would use LaTeX for writing papers, and LibreOffice for "less intense" use cases like a Bachelor's thesis or a report. But in case they use it for papers, what you mention is a valid use case. Let me think over this. For editing citations, it's gonna be the way we ended up editing the numbers but this time editing the style along with it as well. Editing the text was the most brainwreck part, so I'll think of ways to extend that. We won't need to update content of the reference mark this time, so it might be simpler than I am assuming right now. For bibliography, style A-> style B migration already works (since bibliography is repopulated from scratch with each entry), except if one is a jstyle and the other is csl. Fixing that would be linear effort (plan mentioned in my previous comment). |
@subhramit for myself -> have a global optional to detect changes in used styles. If new style detected on next cite, use |
A Bachelor's thesis must also have the same citation style throughout the thesis. Steps here are:
|
Fixes one part of the issue #12262
Also discussed in #11712 (comment)
Changes
Now, when a switch is made from one style "family" to another (CSL->JStyles or JStyles->CSL) in the same document where an existing bibliography of the old family is already present, the next entry cited in the document with the new style will no longer create a separate bibliography section (which led to two independent bibliography sections earlier).
That is, the bibliography section will also switch, and populate entries only pertaining to the currently selected family.
bib_sample.mp4
More details (user-facing):
Since the style parsing and reference marks of JStyles and CSL are different, only the entries cited with CSL will be present in the bibliography (if presently switched to CSL), and the entries cited with JStyle will be present in the JStyle (if switched to JStyle) with no loss of old information (provided the citations are not deleted in the text - so that they can be parsed again to regenerate the corresponding style's bibliography list).
More info (for developers):
The implementation involves using the same text section name for both the CSL and JStyle bibliographies, so that their refresh functions can detect one another and clear them. This obviously hints that a lot of the implementation could be merged into a single class (which is the case with many aspects of JStyle and CSL - the OO backend could be unified to a large extent). However, since the way the code is written for these is very different, the classes for these project classes are currently separated and grouped together for easier modification (at least from the perspective of CSL - which seems to be more important now).
Mandatory checks
Change inCHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)Tests created for changes (if applicable)