Giter VIP home page Giter VIP logo

Comments (4)

dpvc avatar dpvc commented on May 18, 2024

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

from mathjax.

dpvc avatar dpvc commented on May 18, 2024

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 MathJax (and so in particular, MathJax_Preview), so it will not reprocesses previews created by jsMath2jax if it runs first. On the other hand, if tex2jax runs first, \the previews will contain just the text of the mathematics, not any span's or divs of class math, so jsMath will not reprocess them.

The issue should be resolved by the change in the issue18 branch of my fork. See dpvc@6dd80fa for details.

Davide

from mathjax.

shogun70 avatar shogun70 commented on May 18, 2024

Works for me. I've commited it.

from mathjax.

dpvc avatar dpvc commented on May 18, 2024

Thanks.

from mathjax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.