Skip to content

Fix #9.#13

Merged
tomtung merged 1 commit into
tomtung:masterfrom
tobiasdiez:fix9
Jun 3, 2019
Merged

Fix #9.#13
tomtung merged 1 commit into
tomtung:masterfrom
tobiasdiez:fix9

Conversation

@tobiasdiez

Copy link
Copy Markdown
Contributor

With this PR, arguments for unknown commands are preserved. This fixes #9.
Now inputs such as \unknown{param} yield the output \unknown{param} where previously it produced \unknownparam. The implementation treats all blocks that directly follow a unknown command as arguments to this command (e.g. \unknown{param}{param} but \unknown{param} {not a param} because of the space). This leads to false positives if in reality the unknown command excepts less arguments. For example, if \$ is not known to latex2unicode, then \${abc} would still produce \${abc} although in this case it would probably better to produce \$ abc. I went for this implementation due to the following reasons:

  • I believe, strings of the format \command{block}{block} in most cases mean that the command is invoked with two arguments. In latex, you almost never need to use brackets to group things. The only common exception are style commands like {\bf text} - but since \bf and co are deprecated and are supported by latex2unicode, this shouldn't be a big problem.
  • The output from false positives is easier to understand (the previous output \unknownparam leads to confusion, while \unknown{param} still lets the user infer the original meaning).

Preserve arguments for unknown commands
@tomtung tomtung merged commit 3ad274a into tomtung:master Jun 3, 2019
@tobiasdiez tobiasdiez deleted the fix9 branch June 3, 2019 12:30
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

Successfully merging this pull request may close these issues.

Keep unknown commands

2 participants