Skip to content

CSL-based preview does not respect curly braces at author #12930

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

Open
2 tasks done
Siedlerchr opened this issue Apr 13, 2025 · 18 comments
Open
2 tasks done

CSL-based preview does not respect curly braces at author #12930

Siedlerchr opened this issue Apr 13, 2025 · 18 comments
Labels
component: preferences status: depends-on-external A bug or issue that depends on an update of an external library

Comments

@Siedlerchr
Copy link
Member

JabRef version

6.0-alpha

Operating system

macOS

Details on version and operating system

mac os 15.5

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. Create a new entry with the following bibtex data (paste it to the main table)
@Online{,
  author = {{The PGF/TikZ Team}},
  date   = {2023-01-16},
  title  = {pgf – Create PostScript and PDF graphics in TeX},
  url    = {https://ctan.org/pkg/pgf},
}
  1. Under File -> Preferences -> Entry preview at IEEE style after JabRef's custom style
Image 3. Toggle between the style int he preview tab and notice the difference

JabRef style (correct):

Image

CSL Style incorrect:

Image

Classes to look at:
JabRefItemDataProvider

Appendix

...

Log File
Paste an excerpt of your log file here
@github-project-automation github-project-automation bot moved this to Free to take in Good First Issues Apr 13, 2025
@Siedlerchr Siedlerchr added component: preferences good first issue An issue intended for project-newcomers. Varies in difficulty. labels Apr 13, 2025
@priyanshu16095
Copy link
Contributor

/assign-me

@subhramit
Copy link
Member

Unable to reproduce:

Image

@koppor
Copy link
Member

koppor commented Apr 18, 2025

@subhramit The screenshot exactly shows that it is ignored :) -- When author is enclosed in curly braces, it needs to be reproduced in verbatim - and not transformed

Example:

author = {Oliver Kopp}

is then

O. Kopp

and

author = {{Oliver Kopp}}

is then

Oliver Kopp

@subhramit
Copy link
Member

subhramit commented Apr 18, 2025

My thoughts:
Since we use citeproc for both previews and LO, this issue should exist on LO too (and it does).
Treating citeproc as a black box (X):

  1. X->String output. We don't know where authors are in this string (for different styles), so definitive post-processing will not be possible.
  2. Entry->X. I tried to put an additional pair of curly braces and check - the result is unchanged. That means X has some internal mechanism of stripping off the curly braces, so pre-processing is also useless (?). JabRef probably already pre-processes the author field correctly as it is correctly treated in JabRef's custom preview style.

However, I am not sure if we use the same author pre-processing pipeline for both CSL and other styles - that could make a difference (although in LO CSL we use the bibentry as it is).
This is either a good first issue, or depends on citeproc.

@koppor koppor added good second issue Issues that involve a tour of two or three interweaved components in JabRef and removed good first issue An issue intended for project-newcomers. Varies in difficulty. labels Apr 18, 2025
@Siedlerchr
Copy link
Member Author

Siedlerchr commented Apr 18, 2025

We do preprocessing for CSL: Could be the latex2unicode formatter which is the problem
Refs https://github.com/JabRef/jabref-issue-melting-pot/issues/386

for (Field key : fields) {
bibEntry.getResolvedFieldOrAlias(key, bibDatabaseContext.getDatabase())
.map(removeNewlinesFormatter::format)
.map(LatexToUnicodeAdapter::format)
.ifPresent(value -> {
if (StandardField.MONTH == key) {
// Change month from #mon# to mon because CSL does not support the former format
value = bibEntry.getMonth().map(Month::getShortName).orElse(value);
}
bibTeXEntry.addField(new Key(key.getName()), new DigitStringValue(value));
});
}
return BIBTEX_CONVERTER.toItemData(bibTeXEntry);

For MsOffice we had a similar situation where we needed to re-add them

List<MsBibAuthor> result = new ArrayList<>();
// Only one corporate author is supported
// Heuristics: If the author is surrounded by curly braces, it is a corporate author
boolean corporate = !REMOVE_BRACES_FORMATTER.format(authors).equals(authors);
Optional<String> authorLatexFreeOpt = entry.getFieldLatexFree(field);
if (authorLatexFreeOpt.isEmpty()) {
return result;
}
String authorLatexFree = authorLatexFreeOpt.get();
// We re-add the curly braces to keep the corporate author as is.
// See https://github.com/JabRef/jabref-issue-melting-pot/issues/386 for details
if (corporate) {
authorLatexFree = "{" + authorLatexFree + "}";
}

@subhramit
Copy link
Member

I did not mean to be assigned 🤧
/unassign-me

@priyanshu16095
Copy link
Contributor

@subhramit You can take it, I'll focus on my remaining PRs.

@priyanshu16095
Copy link
Contributor

/unassign-me

@subhramit
Copy link
Member

The un-assign action seems to not work.
Either way, I am not taking this, so feel free.

@subhramit subhramit removed their assignment Apr 18, 2025
@subhramit
Copy link
Member

subhramit commented Apr 18, 2025

/assign @priyanshu16095

(I saw above that you were not assigned properly).

@github-actions github-actions bot added the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Apr 18, 2025
Copy link
Contributor

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

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

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

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

@koppor koppor moved this from In Progress to Assigned in Good First Issues Apr 18, 2025
@koppor
Copy link
Member

koppor commented Apr 18, 2025

Tracking of the assingment case:

@priyanshu16095
Copy link
Contributor

This is a good first issue but, I took it with the intention of learning more about CSL or similar things, as I am also new to this.
Thank you for assigning to me.

@subhramit
Copy link
Member

This is either a good first issue, or depends on citeproc.

Refs. michel-kraemer/citeproc-java#103

I do not think this is solvable from our end.

@subhramit
Copy link
Member

I have filed an upstream PR. Lets see what happens.

@subhramit
Copy link
Member

@priyanshu16095 sorry, this ended up being more involved than initially assumed. This needed a fix at the citeproc-java library that we use, and not in JabRef.
Apologies for any time wasted. Please feel free to take other issues or work on the existing ones assigned to you.

@subhramit
Copy link
Member

Un-assigning and adding depends-on-external.
/unassign @priyanshu16095

@github-actions github-actions bot removed the 📍 Assigned Assigned by assign-issue-action (or manually assigned) label Apr 19, 2025
@subhramit subhramit added status: depends-on-external A bug or issue that depends on an update of an external library and removed good second issue Issues that involve a tour of two or three interweaved components in JabRef labels Apr 19, 2025
@subhramit
Copy link
Member

I have filed an upstream PR. Lets see what happens.

Merged, will be fixed in the next version of citeproc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: preferences status: depends-on-external A bug or issue that depends on an update of an external library
Projects
None yet
Development

No branches or pull requests

4 participants