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

retain-zero-exponent = true behaviour change #565

Closed
ArchangeGabriel opened this issue Dec 29, 2021 · 10 comments
Closed

retain-zero-exponent = true behaviour change #565

ArchangeGabriel opened this issue Dec 29, 2021 · 10 comments

Comments

@ArchangeGabriel
Copy link

In v3, this now adds a ×10⁰ to things like \num{7}, while previously it would only display for \num{7e0}. Is there a way to fix that?

@ArchangeGabriel
Copy link
Author

(Also the string seems gone from the documentation)

@ArchangeGabriel
Copy link
Author

Also, in a similar fashion now \num{e4} produces 1×10⁴ whereas it used to produce 10⁴ (the former being produced by \num{1e4}). Certainly not directly related to retain-zero-exponent, but likely a similar change in the code?

@josephwright
Copy link
Owner

This is 'by design'. I was not happy in v2 that the same values could end up printing differently, as I wasn't careful enough about normalisation of input. In v3, I've tightened up the option names to show where the choice is made: this one is now print-zero-exponent, i.e. it's after parsing and is purely about visual formatting.

@ArchangeGabriel
Copy link
Author

Hum, so what you say is that there is no way to have a different output for \num{7} and \num{7e0} as well as \num{e4} and \num{1e4} in 3.x without specifying on specific occurrences print-zero-exponent in the former and print-unity-mantissa in the later? The e0 cases is not too much a big deal (only two instances in all my .tex files), but the other one much more, I have hundred of both, on purpose…

@schtandard
Copy link

schtandard commented Jan 3, 2022

Would a third option print-zero-exponent=input (and accordingly print-unity-mantissa=input) be possible that prints the respective part of the number if and only if it is present in the input?

I'm not sure if there is any precedent for something like this and if this coupling of input and output is undesired, but I also want to mix both settings in the same document (depending on the context of the number) and being able to control the omission of these possibly redundant number parts by just inputting it accordingly used to be rather handy.

At least for print-unity-mantissa I find the new behavior a bit confusing, personally. After all, 1.00 is (correctly) treated differently from 1.0. If 1.0e9 means "two significant digits" and 1e9 means "one significant digit", I would expect e9 to mean "no significant digits" (i.e. just stating the order of magnitude).

@ArchangeGabriel
Copy link
Author

@schtandard Thanks for your input on this, very good points and idea!

@schtandard
Copy link

Another option could be to handle this like drop-zero-decimal, i.e. instead provide two options drop-zero-exponent and drop-unity-mantissa that can drop but never add the redundant part. As I can imagine someone wanting to also add it, I would prefer the option outlined above, though. (Also, this would require changing option names, which is a more severe change.)

@josephwright
Copy link
Owner

I gave this a bit of thought and decided that @schtandard's pint about significant figures is reasonable. I've adjusted the code so the parser retains that difference: I may look at an option to normalise e10 to 1e10 for v3.1 (easy to do, just a question of if it's required).

@josephwright
Copy link
Owner

@ArchangeGabriel Will that work for you? I'm more reluctant to change the parsing of exponents, as I think all numbers do have an order of magnitude

@ArchangeGabriel
Copy link
Author

Yeah, as I said  e0 is a very special case that I use only twice (in my lecture on writing numbers, to say that theoretically we should indicate ×10⁰ but that this is always omitted). So I’m fine manually handling those two. ;)

So thanks for fixing the no-mantissa case, that was actually my biggest grief (but I’ve discovered the change a bit after since the first case appears later in my lectures). :)

josephwright added a commit that referenced this issue May 9, 2023
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