Speech-Rule-Engine / speech-rule-engine

Generating speech descriptions for XML structures
https://zorkow.github.io/speech-rule-engine/
Apache License 2.0
75 stars 39 forks source link

MathSpeak speaking words in <mi> elements as individual letters #728

Open brichwin opened 1 year ago

brichwin commented 1 year ago

Using either MathJax 3.2.2 or 4.0.0-beta.3 when generating speech text for LaTeX that generates multi-char <mi> content, MathSpeak grammar of any verbosity inappropriately spaces runs of non-space text sequences into individual characters. For example, for the following expression: $h{\text{per mole in kJ}} = 3.99 \times 10^{-13} \mathrm{kJ} \times \mathrm{s} \times \mathrm{mol}^{-1}$, notice that the text generated for the \mathrm{mol} part of ```h{\text{per mole in kJ}} = 3.99 \times 10^{-13} \mathrm{kJ} \times \mathrm{s} \times \mathrm{mol}^{-1}```, is "m o l" when the SRE is configured for MathSpeak brief:

h Sub per mole in kJ Base equals 3.99 times 10 Sup negative 13 Base k upper J times normal s times m o l Sup negative 1

This is instead of the expected:

h Sub per mole in kJ Base equals 3.99 times 10 Sup negative 13 Base k upper J times normal s times mol Sup negative 1
View the MathML MathJax created for the example ```xml h per mole in kJ = 3.99 × 10 13 kJ × s × mol 1 ```

Note that ClearSpeak Auto for the same expression correctly returns "mol":

h sub per mole in kJ equals 3.99 times 10 to the negative 13 power kJ times normal s times mol to the negative 1 power
brichwin commented 1 year ago

Side question: Is there a more appropriate way to encode units in LaTeX expressions for MathJax (so the mi elements are generated with mathvariant='normal' class='MathML-Unit')?