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

Option to display (unprocessed) unknown LaTeX commands #8

Closed
olivierfruchart opened this issue Nov 8, 2017 · 5 comments
Closed

Option to display (unprocessed) unknown LaTeX commands #8

olivierfruchart opened this issue Nov 8, 2017 · 5 comments

Comments

@olivierfruchart
Copy link

I report this issue related to the use of latex2unicode since version 4.0 in JabRef, and after a discussion with the JabRef developers team.

For a long time I have been using my own LaTeX functions in fields of JabRef, for instance \prl for the Journal, which upon compilation in LaTeX I translate to Phys. Rev. Lett. As \prl is not recognized as a standard LaTeX command, it is ignored by latex2unicode and removed. As a result, in my table of entries I do not see any more the fields which are coded as private LaTeX commands. For example, I lost completely the overview of the journals.

The developers of JabRef suggested that an option may be added to latex2unicode to specify how an unknown LaTeX command is processed, which is the option I also thought of. The minimum could be "Ignore" and "Display", the latter rendering either \prl or prl. This would be very helpful, possibly beyond JabRef.

@lenhard
Copy link

lenhard commented Nov 8, 2017

I second this! A simple boolean option that tells latex2unicode to either keep or discard unknown commands would be perfect!

@tomtung
Copy link
Owner

tomtung commented Nov 9, 2017

@olivierfruchart @lenhard Can you guys give a more specific description of the problem? e.g. a few examples in the form of:

  • Input
  • Expected output
  • Actual output

Also I haven't touched the codebase or written Scala for quite a while, so I'll need to find some time and re-familiarize myself. A quick look suggests that I might need to make the logic here more flexible:

val block: Parser[String] = P(name.flatMap(s => nameToParser.getOrElse(s, PassWithEmptyString)))

In the meantime, pull requests would also be appreciated :)

@lenhard
Copy link

lenhard commented Nov 9, 2017

From JabRef/jabref#3408

  • Input: "This is a \prl manuscript"
  • Expected output: "This is a prl manuscript" OR "This is a \prl manuscript"
  • Actual output: "This is a manuscript"

I think it wouldn't matter too much if the \ is kept or not, what matters most is that the name of the command prl is kept. @olivierfruchart what are your thoughts on this? Could you provide some more examples from your database?

Also I am not sure how to treat input in the form This is a \prl{manuscript}. That might be hard and we could maybe ignore it for now.

I have no real experience with Scala yet, so a PR seems tempting :) Unfortunately, I am buried in work right now, so don't expect something in the near future.

@olivierfruchart
Copy link
Author

Apologies for my delayed answer. Yes lenhard, your example is exactly my issue. All other examples would be technically identical. In practice my issue is even worse because "\prl" is my full input, so that I get an empty output.

I agree that keeping or removing the \ is a secondary issue. Maybe keeping it is better, so that we can keep track of what \prl{manuscript} means, for the issue of parameter that you raised.

@tomtung
Copy link
Owner

tomtung commented Feb 24, 2018

Should be fixed in the newest version.

@tomtung tomtung closed this as completed Feb 24, 2018
tomtung added a commit that referenced this issue Feb 24, 2018
This is a proper fix for issue #8

In the last version,  unknown commands would cause parsing failures.
For simplicity we create a `PassWith(s)` object every time we encounter
an unknown command. This might be a speed problem if it happens too
often, and can be worked around at the cost of more complexity if
necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants