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: line breaks in annotations are lost #847

Closed
pkra opened this issue Jun 24, 2014 · 7 comments

Comments

Projects
None yet
2 participants
@pkra
Copy link
Member

commented Jun 24, 2014

Issue Summary

Reported on the MathJax user group.

If MathML annotations contain linebreaks, these are lost during processing.

Steps to Reproduce

  1. Let the following render with MahJax

    <math>
    <semantics xref="p1.1.m1.1.cmml"><mo>Test</mo>
    
        <annotation encoding="application/x-tex">{\displaystyle{\displaystyle\sum_{k=1}^{\infty}\frac{\mathop{\zeta\/}\nolimits%
    \!\left(2k\right)}{k}z^{2k}=\mathop{\ln\/}\nolimits\!\left(\frac{\pi z}{%
    \mathop{\sin\/}\nolimits\!\left(\pi z\right)}\right)}}</annotation>
      </semantics>
    </math>
    
  2. Check that Show Math => annotation => TeX gives

    {\displaystyle{\displaystyle\sum_{k=1}^{\infty}\frac{\mathop{\zeta/}\nolimits% !\left(2k\right)}{k}z^{2k}=\mathop{\ln/}\nolimits!\left(\frac{\pi z}{% \mathop{\sin/}\nolimits!\left(\pi z\right)}\right)}}

Similarly for showing the (non-original) MathML source.

This is a bug because it makes the annotations unusable.

Technical details

  • MathJax Version: 2.3+
@dpvc

This comment has been minimized.

Copy link
Member

commented Jun 24, 2014

The newlines are being lost in the MathML input jax. The <annotation> element is being treated like a Token element, where the text is supposed to have newlines replaced by spaces. It will not be hard to fix it.

A smaller example is

<math>
  <semantics>
    <mrow>
      <mi>x</mi><mo>+</mo><mn>1</mn>
    </mrow>
    <annotation encoding="LaTeX">
    x+
    1
    </annotation>
  </semantics>
</math>

@dpvc dpvc added Accepted labels Jun 24, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Jun 24, 2014

@dpvc dpvc added Merged and removed Ready for Review labels Aug 17, 2014

@dpvc dpvc added this to the Next Release milestone Aug 17, 2014

@dpvc

This comment has been minimized.

Copy link
Member

commented Aug 17, 2014

=> Merged.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2015

Trying to write a test, I noticed that the minimal example above

<math>
  <semantics>
    <mrow>
      <mi>x</mi><mo>+</mo><mn>1</mn>
    </mrow>
    <annotation encoding="LaTeX">
    x+
    1
    </annotation>
  </semantics>
</math>

gets converted to

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <mrow>
      <mi>x</mi>
      <mo>+</mo>
      <mn>1</mn>
    </mrow>
    <annotation encoding="LaTeX">
      &#xA;    x+&#xA;    1&#xA;    
    </annotation>
  </semantics>
</math>
@pkra

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2015

This seems not ideal as the ShowSource window wraps the MathML in a pre tag.

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 16, 2015

Anything outside the range U+0020 to U+007E was being translated to numeric entities. I've excluded U+000A (newline), U+000D (return), and U+0009 (tab). That should take care of the problem.

@pkra

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2015

Great. I'll modify my test to fit.

@pkra pkra self-assigned this Jan 16, 2015

pkra added a commit to mathjax/MathJax-test that referenced this issue Jan 20, 2015

dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Jan 20, 2015

@dpvc dpvc added Test Available and removed Test Needed labels Jan 20, 2015

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 20, 2015

==> In Testsuite

UI/issue847.html

@dpvc dpvc added Fixed and removed Merged labels Jan 30, 2015

@dpvc dpvc added the v2.5 label Jan 30, 2015

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.