1

We all know that MathJax renders elements on window onload by default (and can be refreshed using MathJax.Hub.Queue(["Typeset",MathJax.Hub]); Reference Link), but is there a way to 'unrender' the elements? So for example, after the page just loaded, I can click a button, and all the elements will turn back into their TeX code. Is that possible?

Community
  • 1
  • 1
Lucas
  • 16,930
  • 31
  • 110
  • 182

2 Answers2

1

Well, the original TeX code is stored by MathJax, so you can use some javascript to put it back. There is an example of how to do this on the MathJax users forum that I think may be what you are looking for.

Davide Cervone
  • 11,211
  • 1
  • 28
  • 48
0

It seems that MathJax hides the original LaTeX code in an element called MathJax-Element-x, which contains the original code. So what I did was simply hide all elements with the class MathJax_Display, in which the formatted version appeared, and showed all elements starting with MathJax-Element-. Seemed to work fine.

EDIT: Instead of selecting MathJax_Display elements, I had to select all the elements inside MathJax_Display, like MathJax_Display *. I also had to change the type of element the LaTeX code was put in, as it was in a script.

Lucas
  • 16,930
  • 31
  • 110
  • 182
  • 1
    If you managed to unrender MathJax on a page, could you share the script/button that does it? – rych May 08 '14 at 08:15
  • @user612313 I'm sorry - this was from so long ago I'm pretty sure I lost the script itself :D – Lucas May 08 '14 at 11:35
  • @user612313 I think though, all you need to do is grab the original LaTeX code, put it in another element, and then just render the LaTeX using `MathJax.Render` or something - gah, I can't remember anymore. – Lucas May 08 '14 at 11:36