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

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

Open
brichwin opened this issue Aug 11, 2023 · 1 comment
Open

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

brichwin opened this issue Aug 11, 2023 · 1 comment

Comments

@brichwin
Copy link

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
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <msub>
    <mi>h</mi>
    <mrow data-mjx-texclass="ORD">
      <mtext>per mole in kJ</mtext>
    </mrow>
  </msub>
  <mo>=</mo>
  <mrow>
    <mn>3.99</mn>
    <mo>&#xD7;</mo>
    <mrow>
      <msup>
        <mn>10</mn>
        <mrow data-mjx-texclass="ORD">
          <mo>&#x2212;</mo>
          <mn>13</mn>
        </mrow>
      </msup>
      <mo>&#x2062;</mo>
      <mrow data-mjx-texclass="ORD">
        <mi data-mjx-auto-op="false">kJ</mi>
      </mrow>
    </mrow>
    <mo>&#xD7;</mo>
    <mrow data-mjx-texclass="ORD">
      <mi mathvariant="normal">s</mi>
    </mrow>
    <mo>&#xD7;</mo>
    <msup>
      <mrow data-mjx-texclass="ORD">
        <mi data-mjx-auto-op="false">mol</mi>
      </mrow>
      <mrow data-mjx-texclass="ORD">
        <mo>&#x2212;</mo>
        <mn>1</mn>
      </mrow>
    </msup>
  </mrow>
</math>

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
Copy link
Author

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')?

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

1 participant