Skip to content
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

Add cleanup for escaping comments #2011

Closed
bernhard-kleine opened this issue Sep 19, 2016 · 7 comments
Closed

Add cleanup for escaping comments #2011

bernhard-kleine opened this issue Sep 19, 2016 · 7 comments

Comments

@bernhard-kleine
Copy link

bernhard-kleine commented Sep 19, 2016

JabRef 3.6
windows 7 6.1 amd64
Java 1.8.0_66

Steps to reproduce:

  1. import from pubmed the ID 27623067:
  2. run pdflatex with a file where this used
  3. failure to compile due to % sign in the abstract: error message ! File ended while scanning use of \field.

files to reproduce the error can be found here:
http://b-kleine.com/technical/tex_20160918/

edit: this error must have happened very recently since files imported on 2016-09-14 imported correctly.

@bernhard-kleine bernhard-kleine changed the title In Pubmed entry the % in the abstract is not escaped tp \% In Pubmed entry the % in the abstract is not escaped to \% Sep 19, 2016
@Siedlerchr
Copy link
Member

Thanks for your report! As this is not only a pubmed related thing, but a more general problem.
So, I suggest creating a CleanUpAction to automatically encode %-signs.

@koppor
Copy link
Member

koppor commented Sep 21, 2016

This CleanUpAction should also be included in the doPostCleanup method of all fetchers. Refs #1929 (comment) @tobiasdiez

@tobiasdiez
Copy link
Member

Note that biber writes on this topic

[P]lease note that biber will not attempt to sanitise the content of bibtex data sources. That is, don’t expect it to auto-escape any TeX special characters like ‘&’ or ‘%’ which it finds in, for example, your TITLE fields. It used to do this in earlier versions in some cases but as of version 0.9, it doesn’t because it’s fraught with problems and leads to inconsistent expectations and behaviour between different data source types. In your bibtex data sources, please make sure your entries are legal TeX code.

I think JabRef should not escape special characters, especially not always on writing. The cleanup operation is ok because then the user has to decide what he wants to do. For the same reason as above, I would not include it in the doPostCleanup operation of the pubmed fetcher.

@lenhard
Copy link
Member

lenhard commented Sep 23, 2016

I strongly support @tobiasdiez on this. A long time ago, we decided the following development rationale for JabRef: "If in doubt, do as biber does".

Moreover, this cleanup should go into LatexCleanupFormatter, I think. This formatter already takes care of escaping and fixing LaTeX-related stuff.

@bernhard-kleine
Copy link
Author

Has this issue been resolved? With JabRef 3.7dev--snapshot--2016-09-25--medlineutf8--95f7f84, windows 7 6.1 amd64, Java 1.8.0_66 I still ran into the % trap.

@tobiasdiez tobiasdiez changed the title In Pubmed entry the % in the abstract is not escaped to \% Add cleanup for escaping comments Sep 30, 2016
@lenhard
Copy link
Member

lenhard commented Sep 30, 2016

@bernhard-kleine As there are no other comments here since my last one seven days ago: no, it has not.

Also, we will not do this automatically for importing pubmed entries (since the error is really on the side of pubmed which produces broken bibtex).

@stefan-kolb
Copy link
Member

Thank you for your report 👍
This should be fixed in current preserve-percent-sign. Please try the latest build from http://builds.jabref.org/preserve-percent-sign.
You can now use LateXCleanup inside quality->cleanups to escape % to \%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants