MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Failure to correctly display Persian text in the formula in the Firefox browser

Open saraOrkide opened this issue 2 years ago • 4 comments

The Persian text in the formula is displayed as letters instead of being stuck together Of course, in the Chrome browser, it is the same in Firefox ex mml Code: <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'> <mtable xmlns='http://www.w3.org/1998/Math/MathML' columnalign='left'> <mtr> <mtd> <mo>(</mo> <mi>a</mi> <mo>,</mo> <mn>1</mn> <mo>)</mo> <mover accent='false'> <mo>→</mo> <mrow> <mi mathvariant='normal'>ت</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ب</mi> <mi mathvariant='normal'>ع</mi> <mi mathvariant='normal'> </mi> <mi mathvariant='normal'>ه</mi> <mi mathvariant='normal'>م</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ن</mi> <mi mathvariant='normal'>ی</mi> </mrow> </mover> <mi>a</mi> <mo>=</mo> <mn>1</mn> </mtd> <mtd /> </mtr> <mtr> <mtd> <mo>(</mo> <mi>b</mi> <mo>,</mo> <mn>2</mn> <mo>)</mo> <mover accent='false'> <mo>→</mo> <mrow> <mi mathvariant='normal'>ت</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ب</mi> <mi mathvariant='normal'>ع</mi> <mi mathvariant='normal'> </mi> <mi mathvariant='normal'>ه</mi> <mi mathvariant='normal'>م</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ن</mi> <mi mathvariant='normal'>ی</mi> </mrow> </mover> <mi>b</mi> <mo>=</mo> <mn>2</mn> </mtd> <mtd /> </mtr> <mtr> <mtd> <mo>(</mo> <mi>c</mi> <mo>,</mo> <mn>5</mn> <mo>)</mo> <mover accent='false'> <mo>→</mo> <mrow> <mi mathvariant='normal'>ت</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ب</mi> <mi mathvariant='normal'>ع</mi> <mi mathvariant='normal'> </mi> <mi mathvariant='normal'>ه</mi> <mi mathvariant='normal'>م</mi> <mi mathvariant='normal'>ا</mi> <mi mathvariant='normal'>ن</mi> <mi mathvariant='normal'>ی</mi> </mrow> </mover> <mi>c</mi> <mo>=</mo> <mn>5</mn> </mtd> <mtd /> </mtr> <mtr> <mtd /> <mtd /> </mtr> </mtable> </math> result: Screenshot from 2023-12-05 17-00-21

matjax version 2.7.1

saraOrkide avatar Dec 05 '23 13:12 saraOrkide

Because you have each Persian character in a separate <mi> element, they are not able to interact to form the combined characters that you are expecting. For characters that form words or phrases, you would want to put them all inside a single <mtext> element, as in <mtext>تابع همانی</mtext>. Then you need to configure MathJax to use the surrounding font for mtext elements, rather than its own fonts (which don't include these characters). You don't indicate what output jax you are using, so something like

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  CommonHTML: {
    mtextFontInherit: true
  },
  SVG: {
    mtextFontInherit: true
  },
  "HTML-CSS": {
    mtextFontInherit: true
  }
});
</script>

should do the trick. You also probably want to put an mrow around the parentheses to keep them from growing to the size of the mover element. For example:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mtable columnalign="left">
    <mtr>
      <mtd>
        <mrow>
          <mo>(</mo>
          <mi>a</mi>
          <mo>,</mo>
          <mn>1</mn>
          <mo>)</mo>
        </mrow>
        <mover accent="false">
          <mo>→</mo>
          <mtext>تابع همانی</mtext>
        </mover>
        <mi>a</mi>
        <mo>=</mo>
        <mn>1</mn>
      </mtd>
      <mtd></mtd>
    </mtr>
    <mtr>
      <mtd>
        <mrow>
          <mo>(</mo>
          <mi>b</mi>
          <mo>,</mo>
          <mn>2</mn>
          <mo>)</mo>
        </mrow>
        <mover accent="false">
          <mo>→</mo>
          <mtext>تابع همانی</mtext>
        </mover>
        <mi>b</mi>
        <mo>=</mo>
        <mn>2</mn>
      </mtd>
      <mtd></mtd>
    </mtr>
    <mtr>
      <mtd>
        <mrow>
          <mo>(</mo>
          <mi>c</mi>
          <mo>,</mo>
          <mn>5</mn>
          <mo>)</mo>
        </mrow>
        <mover accent="false">
          <mo>→</mo>
          <mtext>تابع همانی</mtext>
        </mover>
        <mi>c</mi>
        <mo>=</mo>
        <mn>5</mn>
      </mtd>
      <mtd></mtd>
    </mtr>
    <mtr>
      <mtd></mtd>
      <mtd></mtd>
    </mtr>
  </mtable>
</math>

would produce

Persian

in the HTML-CSS output jax.

dpvc avatar Dec 05 '23 15:12 dpvc

Duplicate of #2426

dpvc avatar Dec 05 '23 15:12 dpvc

PS, you really should update your version of MathJax. v2.7.1 is quite old. The current version is 3.2.2, with v4.0 out in beta release. The current v2 version is 2.7.9.

dpvc avatar Dec 05 '23 15:12 dpvc

<mtext>تابع همانی</mtext>

Thank you

saraOrkide avatar Dec 06 '23 06:12 saraOrkide