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

Unnecessary \left(\right.) and \left.\right) Pairs in Converted LaTeX from MathML #26

Open
ralinres opened this issue Aug 19, 2024 · 0 comments

Comments

@ralinres
Copy link

ralinres commented Aug 19, 2024

Description:

When converting certain MathML equations to LaTeX using the mathml-to-latex library, the output LaTeX includes unnecessary \left(\right.) and \left.\right) delimiters even when there is no content inside the parentheses. Additionally, spaces between words in mtext elements are handled inconsistently, resulting in the inclusion of \textrm{ } for a simple space.

Example
Input MathML:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <semantics>
    <mrow>
      <msub>
        <mtext>Required Value</mtext>
        <mtext>other</mtext>
      </msub>
      <mo>≥</mo>
      <mfrac>
        <mrow>
          <mn>21</mn>
          <mi>f</mi>
          <msup>
            <mi>t</mi>
            <mn>3</mn>
          </msup>
        </mrow>
        <mrow>
          <mi>A</mi>
          <mi>C</mi>
          <mi>H</mi>
        </mrow>
      </mfrac>
      <mo>⋅</mo>
      <mo fence="true">(</mo>
      <mfrac>
        <msub>
          <mi>I</mi>
          <mi>o</mi>
        </msub>
        <mrow>
          <mn>1000</mn>
          <msub>
            <mi>B</mi>
            <mrow>
              <mtext>Btu</mtext>
              <mi mathvariant="normal">/</mi>
              <mtext>h</mtext>
            </mrow>
          </msub>
        </mrow>
      </mfrac>
      <mo fence="true">)</mo>
    </mrow>
  </semantics>
</math>

Output LaTeX:
\left(\text{Required}\textrm{ }\text{Value}\right)_{\text{other}} \geq \frac{21 f t^{3}}{A C H} \cdot \left(\right. \frac{I_{o}}{1000 B_{\text{Btu} / \text{h}}} \left.\right)
Expected LaTeX:
\text{Required Value}_{\text{other}} \geq \frac{21 f t^{3}}{\text{ACH}} \cdot \left( \frac{I_{o}}{1000 B_{\text{Btu}/\text{h}}} \right)

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