-
-
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
Clear the state #3275
Comments
Macros, once defined (either by hand, or by loading an extension, including by using |
Thanks for your answer. I tried Could you explain how to reinstantiate only the TeX input jax and hook it into the existing MathDocument? Thanks! |
OK, here's what's happening: When the CHTML output jax is rebuilt, it ends up replacing the stylesheet that the original one had set up (and that included the CSS needed to display the character in the original math expressions). So the old expression disappear. A new stylesheet is created, but the information about what characters had already been used (the font cache information) is global, and so the new CHTML jax thinks those characters are already in the stylesheet, and so doesn't add them again. So the new expressions that use the same characters don't show up either. One way around this is to attach the new CHTML output jax to the original stylesheet before typesetting its first equation. That would be done by using MathJax.startup.getComponents();
MathJax.startup.document.outputJax.chtmlStyles = document.getElementById('MJX-CHTML-styles'); This may lead to some redundant CSS being added to the stylesheet, but at leas the original information isn't lost. The other approach is to replace the input jax and hook it into the MathDocument, as you request. For that, you need to do const mathDocument = MathJax.startup.document;
mathDocument.inputJax = MathJax.startup.getInputJax();
mathDocument.inputJax.map((jax) => {
jax.setAdaptor(mathDocument.adaptor);
jax.setMmlFactory(mathDocument.mmlFactory);
jax.initialize();
}); This may be the better choice to avoid unneeded duplication in the stylesheet contents. |
I need a way to compile code without MathJax remembering the commands that I defined in previous compilations.
Describe the solution you'd like
Something like
window.MathJax.clear()
so that MathJax forgets what I compiled before.Describe alternatives you've considered
I tried enclosing the code in braces { } so that the command definition is local, I tried clearing the variables that I found that contained the new command:
and many other things.
Additional context
The output produced by the aforementioned code is
Help would be appreciated. Thanks!!
The text was updated successfully, but these errors were encountered: