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

Bug in linebreaking algorithm #523

Closed
pkra opened this issue Jul 23, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@pkra
Copy link
Member

commented Jul 23, 2013

Here's a sample from OSA. I couldn't reduce it much further, I'm afraid.

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block" id="m177">
  <mrow>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>6</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo stretchy="false">&#x2192;</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#x2213;</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#x2212;</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>6</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo>,</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#x2213;</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>7</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo stretchy="false">&#x2192;</mo>
    <mfrac>
      <mrow>
       <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#x2212;</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>7</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo>,</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>6</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo stretchy="false">&#x2192;</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>6</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo>,</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>7</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo stretchy="false">&#x2192;</mo>
    <mfrac>
      <mrow>
        <mn>1</mn>
      </mrow>
      <mrow>
        <mn>2</mn>
      </mrow>
    </mfrac>
    <msub>
      <mrow>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mi>L</mi>
        <mi>R</mi>
        <mi>R</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo>&#xB1;</mo>
        <mo stretchy="false">|</mo>
        <mi>R</mi>
        <mi>L</mi>
        <mi>L</mi>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
        <mo>&#x2297;</mo>
        <mo stretchy="false">(</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2191;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo>+</mo>
        <mo stretchy="false">|</mo>
        <mo stretchy="false">&#x2193;</mo>
        <mo stretchy="false">&#x3009;</mo>
        <mo stretchy="false">)</mo>
      </mrow>
      <mrow>
        <msub>
          <mrow>
            <mi>QD</mi>
          </mrow>
          <mrow>
            <mn>7</mn>
          </mrow>
        </msub>
      </mrow>
    </msub>
    <mo>.</mo>
  </mrow>
</math>

dpvc pushed a commit to dpvc/MathJax that referenced this issue Oct 28, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Oct 28, 2013

This turns out to be due to MathJax's attempts to determine the nesting level of "flat" MathML (i.e., MathML that doesn't use <mrow> to indicate nesting) by using open and close delimiters. When these were unmatched, as in this case (due to the right-angle-brackets), the nesting count was getting confused.

The issue523 branch of my fork of MathJax includes a fix for this.

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Oct 30, 2013

MathMLToDisplay/issue523.html

=> Ready for release, in testsuite

@ghost ghost assigned dpvc Oct 30, 2013

dpvc pushed a commit that referenced this issue Oct 30, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Oct 30, 2013

=> Merged

@fred-wang fred-wang closed this Nov 5, 2013

@dpvc dpvc removed their assignment Jul 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.