TeX translation could be improved for numbers
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Issue Summary
The translation for numbers containing spaces or commas could be improved
Issue details:
- With this input
16\,807MathJax will produce the following MathML when using "copy to clipboard:mathml"
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" data-semantic-type="infixop" data-semantic-role="implicit" data-semantic-annotation="clearspeak:unit" data-semantic-id="4" data-semantic-children="0,2" data-semantic-content="3" data-semantic-speech="16 807">
<mn data-semantic-type="number" data-semantic-role="integer" data-semantic-font="normal" data-semantic-annotation="clearspeak:simple" data-semantic-id="0" data-semantic-parent="4">16</mn>
<mstyle scriptlevel="0">
<mspace width="0.167em" data-semantic-type="operator" data-semantic-role="space" data-semantic-id="3" data-semantic-parent="4" data-semantic-operator="infixop,⁢"></mspace>
</mstyle>
<mn data-semantic-type="number" data-semantic-role="integer" data-semantic-font="normal" data-semantic-annotation="clearspeak:simple" data-semantic-id="2" data-semantic-parent="4">807</mn>
</math>
Notice that the number is broken up into two mn's. Also notice that SRE is interpreting the space as multiplication. Although it is possible this is what is meant, I think it is far more likely that this is meant to be a single number. Context and digit block counting could be used to choose one interpretation in favor of another.
A similar issue arises when using,. E.g., 7^5=16,807. In this case, context clearly points to 16,807 being a single number.
This poor translation will effect speech. Potentially it affects braille generation also.
Technical details:
- MathJax Version: 3 (lastest) -- output is from https://mathjax.github.io/MathJax-demos-web/input-tex2chtml.html
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the inputs in the MathJax v3 tex2chtml demo and inspect the generated MathML and speech interpretation, especially for 16,807 and 16,807. Trace the TeX-to-MathML and semantic translation path; done means grouped numbers are translated consistently without treating separators as multiplication when context indicates a single number.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, tex
- Domain
- accessibility
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100