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

LaTeX: ranges of SI units disappear during conversion #6417

Closed
efharkin opened this issue Jun 2, 2020 · 2 comments
Closed

LaTeX: ranges of SI units disappear during conversion #6417

efharkin opened this issue Jun 2, 2020 · 2 comments

Comments

@efharkin
Copy link
Contributor

efharkin commented Jun 2, 2020

Description of bug and steps to reproduce

As of the current master (7c6dbd3) ranges of SI units provided by \SIRange{firstvalue}{secondvalue}{unit} of siunitx are dropped during parsing of LaTeX files. This leads to funny conversions like the following:

Original LaTeX test_sirange.tex

Something important is happening \SIRange{100}{200}{\ms} after the event.

Expected output in markdown

Something important is happening 100 ms to 200 ms after the event.

Actual output of pandoc -so test_sirange.md test_sirange.tex

Something important is happening after the event.

Why is this a bug?

The manual states that pandoc doesn't aim for perfect document conversion, and that in particular formatting details may not be preserved across formats. However, by dropping \SIRange, pandoc's output can become semantically different from the original LaTeX (ie phrases might not make sense or even take on a different meaning after conversion), so this isn't a formatting detail.

Proposed fix

siunitx's \SIRange is highly configurable. Depending on the options used, \SIRange{100}{200}{\ms} might be rendered as

  • 100 ms to 200 ms
  • 100 ms – 200 ms
  • 100 – 200 ms
  • etc

In the spirit of prioritizing semantics over formatting details, I think it would be good enough for pandoc to support only the first option. I've implemented this approach and will submit a PR shortly.

Related issues and PRs

How pandoc should parse siunitx commands has also been discussed in issue #3587. I'm opening a new issue because that issue (and the associated PR #3823) have been focused on the \num command and are a bit stale.

@efharkin
Copy link
Contributor Author

efharkin commented Jun 2, 2020

Implemented a fix here #6418.

@tarleb
Copy link
Collaborator

tarleb commented May 9, 2021

Closing, as the fix was merged last year. (Thanks!)

@tarleb tarleb closed this as completed May 9, 2021
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

2 participants