-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
the tex2jax and jsMath2jax preprocessors interfere with each other #18
Comments
It looks like there is more to it that that. If the tex2jax processor runs first, it will see \begin{xxx}...\end{xxx} that is in the <span class="math">...</span> and process it, then the jsMath2jax processor will take the innerHTML of the span (which now includes a preview and script tag) and make that into the text of a new script tag. So the preview and script from tex2jax becomes part of the typeset output of jsMath2jax. Perhaps having jsMath2jax check if the contents already includes a math script and simply removing the span or div in that case would be sufficient. Davide |
The problem turned out to be what I said above: when tex2jax runs first, it processes the contents of the <span class="math"> if it contains a LaTeX environment (since those are processed without other math delimiters), adding a preview and math script inside the span. Then jsMath2jax turns the span into another math span, with its innerHTML as the content of the math. That turns the preview and script into text that becomes part of the math. The solution is to prevent jsMath2tex from processing the contents of a span that already has a math script it in (presumably from tex2jax). This works because the span is not supposed to contain anything but text, so if there is a script in it, it is invalid anyway, so it should not be processed. The issue of processing the previews turns out to not be a problem after all. The tex2jax preprocessor already skips tags with class containing The issue should be resolved by the change in the issue18 branch of my fork. See dpvc@6dd80fa for details. Davide |
Works for me. I've commited it. |
Thanks. |
It looks like tex2jax and jsMath2jax can cause problems for each other. In particular, it looks like the preview for one can get translated by the other one (e.g., when the preview includes a LaTeX environment, which will look like math to be processed by the other one).
This needs to be looked into more carefully to see what is actually going on. It may be enough to check that the parent element is not of class MathJax_Preview.
See http://groups.google.com/group/mathjax-users/browse_thread/thread/40ba5ea8541d93cf/6394fd166c7c6c02?hl=en#6394fd166c7c6c02 for details.
Davide
The text was updated successfully, but these errors were encountered: