Add cleanup action for "LaTeX to LaTeX aware Unicode"
Problem:
- There is no cleanup action that allows converting (old) bibliographic data that is (still) formatted in LaTeX with Non-Unicode characters to Unicode aware LaTeX formatting (newer LaTeX engines (e.g. LaTeX2e) can now read most Unicode characters).
- Current workarounds include converting to from LaTeX to Unicode and then back to LaTeX, while manually checking, if any characters were wrongly converted. This is inefficient and takes a long time.
- This workaround is bothersome, because there are symbols that do not get converted when using LaTeXToUnicode and UnicodeToLaTeX cleanup actions (e.g. #3644) and there are other special symbols that SHOULD not get converted automatically, because multiple conversions are possible and users would need to take take manually (e.g. #8712)
Desired Solution:
- Create cleanup action for "LaTeX to Unicode aware LaTeX".
Example workflow:
-
Have the following entry (BEFORE using the cleanup action):
@Article{Testkey, author = {Testauthor}, title = {Bibliographic data that can be read by LaTeX engines}, a = {Here is a backslashed percentage sign \% and it should be excluded from conversion}, b = {Here is a \textcopyright{} and it should be converted to Unicode}, }(Comment:
\textcopyright{}can be converted to©by the inputenc package. When using the LaTeX to Unicode aware LaTeX cleanup action, the result of the conversion should also be©) -
Use cleanup action "LaTeX to Unicode aware LaTeX"
-
AFTER using the cleanup action, the following result should emerge:
@Article{Testkey, author = {Testauthor}, title = {Bibliographic data that can be read by LaTeX engines}, a = {Here is a backslashed percentage sign \% and it should be excluded from conversion}, b = {Here is a © and it should be converted to Unicode}, }
"Special Symbols" that would need to be excluded from conversion:
- The list should be similar to the symbols mentioned in #8712.
- At the very least Page 15 (Tables 1); Table 1 lists escapable special characters in LaTeX.
- Maybe also Page 15 Table 2 and Page 16 Table 3.
- There might be a lot more, but I am not knowledgable enough to list them here. If you know of any, just post it in this thread.
Additional Information
- When working on this, The Comprehensive LATEX Symbol List will be of help. Especially chapters about "Unicode" (Page 272) and "Special Characters" (Page 15-16).
- JabRef currently uses https://github.com/tomtung/latex2unicode; Maybe it can be adapted internally in JabRef (e.g. some pre-processing). Another solution would be to fork it or ask tomtung about creating a LaTeX2UnicodeAwareLaTeX converter.
Originally posted by @ThiloteE in https://github.com/JabRef/jabref/issues/8490#issuecomment-1107461770
Hello, can I take this issue? I have done something related to cleanup actions.
Sure you can!
For the record - behavior of today:
Result:
@Article{Testauthor,
author = {Testauthor},
title = {Bibliographic data that can be read by LaTeX engines},
a = {Here is a backslashed percentage sign % and it should be excluded from conversion},
b = {Here is a \textcopyright{} and it should be converted to Unicode},
}
Hi, I'd like to work on this. My plan would be to add a new formatter that converts LaTeX commands to Unicode via LatexConv while leaving escaped specials (%, &, $, #, _, {, }) untouched, register it next to the other converters, and cover it with parameterized tests based on the example above. Two questions before I start Is a formatter the preferred place (vs. a dedicated cleanup action), and is the escapable-character table from the issue the right initial exclusion list?
/assign-me
👋 Hey @Constant-Sudo, 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. When using AI tools, please use them as an assistant rather than simply copying their output. See Don't paste the AI, please.. 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! 🚀
We think that this issue was fixed. Please head to https://builds.jabref.org/main to download a development build and try it out.
For any feedback, add a comment to the pull request at https://github.com/JabRef/jabref/pull/17554.