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

Unit format if numerator is 1 in unit faction #335

Open
PsychoPhobic opened this issue Dec 9, 2023 · 3 comments · May be fixed by #348
Open

Unit format if numerator is 1 in unit faction #335

PsychoPhobic opened this issue Dec 9, 2023 · 3 comments · May be fixed by #348
Assignees

Comments

@PsychoPhobic
Copy link

Unit.new("1000 min^-1") is shown as 1000 1/min but it looks like 10001/min in mathml

units with numerator = 1 in unit fraction should use notation like 1000 min^-1 with tag

@olbrich
Copy link
Owner

olbrich commented Dec 9, 2023

This library makes no attempt to support MathML, but you can probably build some custom support be inspecting the numerator and denominator of a particular instance of a unit.

@PsychoPhobic
Copy link
Author

What i mean is Unit.new("1000 min^-1").to_s #=> retrurns "1000 1/min"
maybe it should return "1000 min^-1" in gerneral for readability if only units exists with power of -1. This would be also allow to directly use it inline in Katex string.

is there at the moment any methods for getting nummerator and denominator for only the Unit part ("1/min")?

@olbrich olbrich self-assigned this Mar 16, 2024
olbrich added a commit that referenced this issue Mar 16, 2024
Fixes #335

Add `format: :exponential` as an option on `#to_s` and `units`.

This will formate the unit with all units treated like exponentials, ones in the denominator will have negative powers.
@olbrich
Copy link
Owner

olbrich commented Mar 16, 2024

@PsychoPhobic take a look at the associated PR and let me know if that meets your needs.

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

Successfully merging a pull request may close this issue.

2 participants