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

Explicit line break between two mtext elements is ignored #707

Closed
dpvc opened this issue Jan 5, 2014 · 4 comments

Comments

Projects
None yet
1 participant
@dpvc
Copy link
Member

commented Jan 5, 2014

The line break in

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mtext>ab</mtext>
  <mo linebreak="newline"></mo>
  <mtext>cd</mtext>
</math>

is ignored in HTML_CSS mode, and causes a [Math Processing Error] in SVG output.

@dpvc dpvc added Ready for Review and removed Investigate labels Feb 14, 2014

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Feb 14, 2014

It turns out that the issue, here, is that <mtext> is considered space-like (whether it is empty or not), and so the inferred <mrow> surrounding the three elements is an embellished operator. That means the three should be treated as a single unit, and the break should occur before the embellished operator, not within the operator. So this is, technically, correct behavior. That is,

<math display="block">
  <mi>x</mi>
  <mrow>
    <mtext>ab</mtext>
    <mo linebreak="newline"></mo>
    <mtext>cd</mtext>
  </mrow>
<math>

should be rendered

x
abcd

since the "ab" and "cd" are embellishments to the operator that is the linebreak.

One solution would be to not consider an <mrow> with more than one element to be embellished (for purposes of linebreaking). This would allow the break to occur between the "ab" and the "cd", yielding

xab
cd

Alternatively, the TeX \\ could insert an empty <mo> along with the one that forces the line break, so that the inferred <mrow> is no longer an embellished operator, and so will break normally. THis might be more natural than fiddling with the definition of embellished.

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 14, 2014

Davide P. Cervone
Forced explicit linebreak between text elements to not look like an e…
…mbellished operator. Resolves issue mathjax#707.  Note however, that Firefox treats this differently (it seems not to treat mtext as space-like in this case).

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 14, 2014

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Feb 14, 2014

I ended up using <mspace> rather than <mo> to avoid the possibility of it being an embellished operator.

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 14, 2014

@dpvc dpvc added Merged and removed Ready for Review labels Feb 14, 2014

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Feb 14, 2014

=> Merged.

@dpvc dpvc closed this Feb 14, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 14, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Feb 14, 2014

dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Apr 21, 2014

@dpvc

This comment has been minimized.

Copy link
Member Author

commented Apr 21, 2014

=> In Test Suite.

MathMLToDisplay/Topics/LineBreak/issue707.html

@dpvc dpvc added v2.4 and removed Merged labels Jun 30, 2014

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.