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

Comment causes IE to ignore rest of equation #89

Closed
dpvc opened this issue Mar 26, 2011 · 6 comments
Closed

Comment causes IE to ignore rest of equation #89

dpvc opened this issue Mar 26, 2011 · 6 comments
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Test Available

Comments

@dpvc
Copy link
Member

dpvc commented Mar 26, 2011

In IE, when tex2jax is used, a comment will cause the rest of the equation to be ignored, not just the rest of the line containing the comment. This is true for IE modes < IE9 (IE9 standards mode is OK).

@dpvc
Copy link
Member Author

dpvc commented Mar 26, 2011

This problem is due to the fact that IE converts newlines to spaces when it initially parses the page (similar to the disappearing space problem). This means MathJax can't tell where the end of the line is when it processes a comment, as the line goes to the end of the mathematics.

Since the text of the document is damaged long before MathJax gets to loot at it, there is little MathJax can do about it, unfortunately.

The page author has two options for including comments in the math:

  • Use a <!--[CDATA[ ... ]]--> comment around the mathematics (within the math delimiters), which causes IE to not remove the line breaks.
  • Not use tex2jax preprocessor and put the MathJax <script type="math/tex"> around the mathematics by hand. (Or at least mark the math with comments that way.)

I also propose a new solution:

  • Use <br /> at the end of the comment. This is easy to implement, and a bit easier on the author (though it is still a change from the original TeX source).

I don't really see any other way around this, as the original text has to be modified in some way in order to make this work (MathJax can't do it itself, since damage is already done by the time MathJax runs.)

Davide

@dpvc
Copy link
Member Author

dpvc commented Mar 26, 2011

A patch that implements my suggestion is in branch issue89 of my fork of MathJax.

@fred-wang
Copy link
Contributor

I've added the following unit test:

$$ a + % comment d $$

and tested with IE9 mode < 9. However the bug does not seem to be fixed on the branch issue89. (of course, I've cleared the cache and restart IE). The commit log indicates "Partial work-around" so maybe it's normal.

@dpvc
Copy link
Member Author

dpvc commented Mar 29, 2011

The issue is not going to be resolved for documentMode < 9 without changes to the original document. The "partial work-around" is to allow you to enter

$$
  a + % comment <br />
  d
$$

and have it properly recognize the end of the comment in documentMode < 9. The original comment without the <br /> is never going to work properly in documentMode < 9.

Davide

@fred-wang
Copy link
Contributor

OK, thanks for the information. In that case I'll also add a version of the test with the <br/>.

@dpvc
Copy link
Member Author

dpvc commented Apr 4, 2011

I've committed this to master. I'm closing the issue, since I don't see anything we can do about it, but I'll leave the "accepted" tag, since it isn't really fixed, and we can look at it again later, if need be.

@dpvc dpvc closed this as completed Apr 4, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Browser Bug Test Available
Projects
None yet
Development

No branches or pull requests

2 participants