Comments (4)
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.
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.
Works for me. I've commited it.
from mathjax.
Thanks.
from mathjax.
Related Issues (20)
- Why display and MathJax equation source do not match? HOT 3
- Latex comment after "\end{equation}" ignored. HOT 1
- MJ4-beta.4: \_ in math mode yields error, not underscore character. Is that expected? HOT 2
- Review security report HOT 2
- MJ4: \mskip\thickmuskip yields typesetting error HOT 2
- Display problem Norm (mathematics) HOT 2
- How to allow context menu to show in version 3.2.2 ? HOT 2
- `[]` rendered improperly in `aligned` environment HOT 1
- [v4.beta4] unexpected TeX parser crash (regression from beta3) HOT 4
- How to define \symrm in Mathjax 2.7 HOT 3
- Change MathJax version 2.7.9 to 3.2.2 HOT 2
- Axe test: Ensures elements with an ARIA role that require child roles contain them HOT 1
- What are best practices for using MathJax in ReactJS/NextJS? HOT 3
- error while loading mathjax in react with vite HOT 4
- Display a highlight on part of the formula HOT 2
- Rendering bug when Chinese chars in \text block HOT 2
- [TeX] support for \hdotsfor (from amsmath) HOT 1
- Invalid SVG markup in MathJax 4.0.0-beta6 HOT 2
- can "reset to defaults" be hooked into? HOT 1
- Speech generation is on by default in MathJax 4 beta 6 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathjax.