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

Problem displaying the formula #3197

Open
saraOrkide opened this issue Feb 28, 2024 · 2 comments
Open

Problem displaying the formula #3197

saraOrkide opened this issue Feb 28, 2024 · 2 comments
Labels
Expected Behavior This is how MathJax works

Comments

@saraOrkide
Copy link

saraOrkide commented Feb 28, 2024

The displayed formula is not the same as what was typed in the Word environment

In the word file it is like this:
wordFileScreenShot
But when it is converted from word to mml, it is displayed like this:
Screenshot from 2024-02-28 14-51-47
As you can see, the formula should have gone to the next line, but it didn't
mathjax version: mathjax-4.0.0-beta.4
using mml-chtml.js
os: windows and linux
browser: chrome and firefox
setting :

chtml: {
                    displayAlign: 'right',
                    scale: 1,
                    merrorInheritFont: !0,
                    matchFontHeight: false,
                    mtextFont: 'fontRegular, Noto Sans, sans-serif',
                    mtextInheritFont: false,
                    unknownFamily: 'fontRegular, Noto Sans, sans-serif',
                    font: 'mathjax-fira',
                },

word file:
sample.docx

mml code for this section:

    <div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span dir=rtl><span style='color:#000000;'>الف)</span></span></span></div><div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><menclose notation='box'><mn>3000</mn></menclose></mtd><mtd><mo></mo></mtd><mtd><mn>7600</mn><mo>-</mo><mn>4300</mn></mtd><mtd><mo></mo></mtd><mtd><menclose notation='box'><mn>4000</mn></menclose></mtd></mtr><mtr><mtd><mo></mo></mtd><mtd><mo></mo></mtd><mtd><mn>2300</mn><mo>+</mo><mn>4200</mn></mtd><mtd><mo></mo></mtd><mtd><mo></mo></mtd></mtr><mtr><mtd><mo></mo></mtd><mtd><mo></mo></mtd><mtd><mn>3400</mn><mo>+</mo><mn>2100</mn></mtd><mtd><mo></mo></mtd><mtd><mo></mo></mtd></mtr></mtable></math></span></span></div><div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span dir=rtl><span style='color:#000000;'>ب)</span></span></span></div><div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><menclose notation='box'><mn>3000</mn></menclose></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>7600</mn><mo>-</mo><mn>4300</mn></mrow><mo></mo></munder></mrow><mrow><mn>3300</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><menclose notation='box'><mn>4000</mn></menclose></mtd></mtr></mtable><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><mo></mo></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>2300</mn><mo>+</mo><mn>4200</mn></mrow><mo></mo></munder></mrow><mrow><mn>6500</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><mo></mo></mtd></mtr></mtable><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><mo></mo></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>3400</mn><mo>+</mo><mn>2100</mn></mrow><mo></mo></munder></mrow><mrow><mn>5500</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><mo></mo></mtd></mtr></mtable></math></span></span></div><div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span dir=rtl><span style='color:#000000;'>ج)</span></span></span></div><div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'><span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><menclose notation='box'><mn>3000</mn></menclose></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>7600</mn><mo>-</mo><mn>4300</mn></mrow><mo></mo></munder></mrow><mrow><mn>3300</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><menclose notation='box'><mn>4000</mn></menclose></mtd></mtr></mtable><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><menclose notation='box'><mn>6000</mn></menclose></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>2300</mn><mo>+</mo><mn>4200</mn></mrow><mo></mo></munder></mrow><mrow><mn>6500</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><menclose notation='box'><mn>7000</mn></menclose></mtd></mtr></mtable><mtable xmlns='http://www.w3.org/1998/Math/MathML' ><mtr><mtd><menclose notation='box'><mn>5000</mn></menclose></mtd><mtd><mo></mo></mtd><mtd><munder><mrow><munder accentunder='false'><mrow><mn>3400</mn><mo>+</mo><mn>2100</mn></mrow><mo></mo></munder></mrow><mrow><mn>5500</mn></mrow></munder></mtd><mtd><mo></mo></mtd><mtd><menclose notation='box'><mn>6000</mn></menclose></mtd></mtr></mtable></math></span></span></div>
@dpvc
Copy link
Member

dpvc commented Feb 28, 2024

MathJax's rendering is correct for the MathML that you have supplied. Three mtable elements in a row, with no intervening elements, as in your second and third expressions, should be rendered horizontally as MathJax does. As these fall within a single inline math element, there are no valid in-line breakpoints for MathJax's in-line breaking algorithm. It may be that Word allows line breaks at these points (the MathML specification does not specify an in-line breaking algorithm).

You probably want to combine the three separate mtable elements into a single table, as in your first expression. For example:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline" mathcolor="#050038">
  <mtable>
    <mtr>
      <mtd>
        <menclose notation="box">
          <mn>3000</mn>
        </menclose>
      </mtd>
      <mtd>
        <mo>&#x21D0;</mo>
      </mtd>
      <mtd>
        <munder>
          <mrow>
            <munder>
              <mrow>
                <mn>7600</mn>
                <mo>-</mo>
                <mn>4300</mn>
              </mrow>
              <mo>&#x23DF;</mo>
            </munder>
          </mrow>
          <mrow>
            <mn>3300</mn>
          </mrow>
        </munder>
      </mtd>
      <mtd>
        <mo>&#x21D2;</mo>
      </mtd>
      <mtd>
        <menclose notation="box">
          <mn>4000</mn>
        </menclose>
      </mtd>
    </mtr>
    <mtr>
      <mtd>
        <mo>&#x2026;</mo>
      </mtd>
      <mtd>
        <mo>&#x21D0;</mo>
      </mtd>
      <mtd>
        <munder>
          <mrow>
            <munder>
              <mrow>
                <mn>2300</mn>
                <mo>+</mo>
                <mn>4200</mn>
              </mrow>
              <mo>&#x23DF;</mo>
            </munder>
          </mrow>
          <mrow>
            <mn>6500</mn>
          </mrow>
        </munder>
      </mtd>
      <mtd>
        <mo>&#x21D2;</mo>
      </mtd>
      <mtd>
        <mo>&#x2026;</mo>
      </mtd>
    </mtr>
    <mtr>
      <mtd>
        <mo>&#x2026;</mo>
      </mtd>
      <mtd>
        <mo>&#x21D0;</mo>
      </mtd>
      <mtd>
        <munder>
          <mrow>
            <munder>
              <mrow>
                <mn>3400</mn>
                <mo>+</mo>
                <mn>2100</mn>
              </mrow>
              <mo>&#x23DF;</mo>
            </munder>
          </mrow>
          <mrow>
            <mn>5500</mn>
          </mrow>
        </munder>
      </mtd>
      <mtd>
        <mo>&#x21D2;</mo>
      </mtd>
      <mtd>
        <mo>&#x2026;</mo>
      </mtd>
    </mtr>
  </mtable>
</math>

Note that I've also removed the accentunder="false" attributes, which are not what you want, here. The underprices are accents, and want to be rendered at the same size as the expression they are under, not at a reduced size (as non-accents are), and accents get placed closer to the material they are under (or over), rather than on a separate baseline as non-accents are.

An alternative would be to place <mo linebreak="newline"></mo> between the tables, but the spacing between the lines will not be as good.

@dpvc dpvc added the Expected Behavior This is how MathJax works label Feb 28, 2024
@saraOrkide
Copy link
Author

I'm sorry, I had sent the mml for only one mtable
complete mml:
<div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span dir=rtl><span style='color:#000000;'>الف)</span></span></span></div> <div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <menclose notation='box'> <mn>3000</mn> </menclose> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <mn>7600</mn> <mo>-</mo> <mn>4300</mn> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <menclose notation='box'> <mn>4000</mn> </menclose> </mtd> </mtr> <mtr> <mtd> <mo>…</mo> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <mn>2300</mn> <mo>+</mo> <mn>4200</mn> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <mo>…</mo> </mtd> </mtr> <mtr> <mtd> <mo>…</mo> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <mn>3400</mn> <mo>+</mo> <mn>2100</mn> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <mo>…</mo> </mtd> </mtr> </mtable> </math></span></span></div> <div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span dir=rtl><span style='color:#000000;'>ب)</span></span></span></div> <div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <menclose notation='box'> <mn>3000</mn> </menclose> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>7600</mn> <mo>-</mo> <mn>4300</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>3300</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <menclose notation='box'> <mn>4000</mn> </menclose> </mtd> </mtr> </mtable> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <mo>…</mo> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>2300</mn> <mo>+</mo> <mn>4200</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>6500</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <mo>…</mo> </mtd> </mtr> </mtable> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <mo>…</mo> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>3400</mn> <mo>+</mo> <mn>2100</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>5500</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <mo>…</mo> </mtd> </mtr> </mtable> </math></span></span></div> <div class='chistaItem' style='text-align:right;justify-content:right;/*MARK-BY-CHISTA-PARSER*/;direction:rtl;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span dir=rtl><span style='color:#000000;'>ج)</span></span></span></div> <div class='chistaItem' style='text-align:left;justify-content:left;/*MARK-BY-CHISTA-PARSER*/;direction:ltr;/*MARK-BY-CHISTA-PARSER*/;'> <span class='chistaText'><span class='chistaFormula'><math xmlns='http://www.w3.org/1998/Math/MathML' display='inline' mathcolor='#050038'> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <menclose notation='box'> <mn>3000</mn> </menclose> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>7600</mn> <mo>-</mo> <mn>4300</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>3300</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <menclose notation='box'> <mn>4000</mn> </menclose> </mtd> </mtr> </mtable> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <menclose notation='box'> <mn>6000</mn> </menclose> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>2300</mn> <mo>+</mo> <mn>4200</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>6500</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <menclose notation='box'> <mn>7000</mn> </menclose> </mtd> </mtr> </mtable> <mtable xmlns='http://www.w3.org/1998/Math/MathML'> <mtr> <mtd> <menclose notation='box'> <mn>5000</mn> </menclose> </mtd> <mtd> <mo>⇐</mo> </mtd> <mtd> <munder> <mrow> <munder accentunder='false'> <mrow> <mn>3400</mn> <mo>+</mo> <mn>2100</mn> </mrow> <mo>⏟</mo> </munder> </mrow> <mrow> <mn>5500</mn> </mrow> </munder> </mtd> <mtd> <mo>⇒</mo> </mtd> <mtd> <menclose notation='box'> <mn>6000</mn> </menclose> </mtd> </mtr> </mtable> </math></span></span></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expected Behavior This is how MathJax works
Projects
None yet
Development

No branches or pull requests

2 participants