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

Use a different list separator based on locale #889

Closed
christianp opened this issue Feb 24, 2022 · 0 comments
Closed

Use a different list separator based on locale #889

christianp opened this issue Feb 24, 2022 · 0 comments

Comments

@christianp
Copy link
Member

christianp commented Feb 24, 2022

In locales where a comma is the decimal separator, it's not appropriate to use a comma to separate items in a list.

There doesn't seem to be a single widely-used convention for what to use instead (see https://whystartat.xyz/wiki/Separating_arguments_of_a_function), but I think a semicolon would be acceptable.

LaTeX and JME renderings should be handled differently - it would be very difficult to manage producing and evaluating different JME code based on locale.

christianp added a commit that referenced this issue Sep 29, 2022
The symbol used to separate items in a list, such as the arguments of a
function or elements of a set, is now localised in LaTeX. For locales
where the decimal separator is a comma, a semicolon is used as the list
separator.

Fixes #889

It became apparent that when you render a number in LaTeX, a comma needs
not to have space around it.

This commit splits the number notation style format method into two
versions, for plain text and LaTeX.

Numbas.math.niceNumber takes a `syntax` option to specify which version
to use, and `scientificStyle` to specify the notation style used for the
significand when `style = "scientific"`.

The JME functions `formatnumber`, `dpformat` and `sigformat` need to
work differently when the output is going to be used as LaTeX.

There is already a `scientificnumberlatex` function for scientific
notation, but I don't think this is the right approach now it's clear
every notation style works differently in LaTeX.
Could the `latex()` function set a `syntax` attribute on the scope while
it evaluates its argument, so that it gets passed through to
`niceNumber` whenever it's used?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant