metanorma / isodoc

Generate HTML/Word from Metanorma XML
https://www.metanorma.org
BSD 2-Clause "Simplified" License
4 stars 3 forks source link

Switch between general and scientific notation based on size #602

Closed opoudjis closed 2 months ago

opoudjis commented 2 months ago

In number formatting, we support notation as being one of general, scientific, engineering, or e.

It is commonplace to alternate between general and scientific notation for numbers beyond a certain size; so 30, but 3.0 × 10^23^. We are injecting numbers into Metanorma from external sources, and it would be useful to automate that switch, rather than force it in source data.

I will add three parameters to our realisation of number formatting to support this:

These values do not need to be propagated to Plurimath: they will be resolved in isodoc with its preprocessing of number formatting attributes.

opoudjis commented 2 months ago

Any explicit notation attribute will still end up overridden by an inherited large_notation attribute: so if I have large_notation = scientific as a formatting default, then an explicit notation=e will be ignored for a large number in favour of scientific -- unless I set large_notation = nil. That's not that big a deal, but will need to be documented.

ronaldtse commented 2 months ago

@opoudjis why not delegate that to Plurimath?

opoudjis commented 2 months ago

Because this is logic about which notation to use; I do not believe it appropriate to put such decision logic into Plurimath. Plurimath should be dealing with fixed options for simplicity.

opoudjis commented 2 months ago

0 should not be formatted in large_notation but in general notation: it should not be treated like 1e-23.