# old \def definitions linger

It's possible to use \def, and it usually works. However, there's a problem in that the definitions stick around and there seems to be no way to get rid of them short of reloading the page. This might not be so bad if it weren't for the fact that it messes up standard commands whose names appear temporarily while a custom command name is being typed.

For instance, say I have \int_{-\pi}^\pi and I realize I'll be writing lots of these integrals, so I enclose it in braces and type \def\intp in front of it. Before I type the final 'p', the result is \def\int{\int_{-\pi}^\pi}. This redefines \int (in this case to something self-referential that causes an error), and that definition doesn't get cleared when I type the final 'p'. (This happens no matter how fast I type.) From then on, trying to use \int causes an error, even after deleting the entire definition, and the only way to get it to work again seems to be to reload the page.

• Hmmm. Is this an SE bug or a MathJax one? Dec 26 '11 at 2:17
• @cardinal: Sounds like either a MathJax bug, or a MathJax "feature" that we should turn off. Dec 26 '11 at 5:08
• This is probably a silly suggestion, but if this is due to insta-parsing...Does it help, if you paste 'intp' to the correct place as opposed to type it? Dec 29 '11 at 19:44
• @Jyrki: Yes, there are various workarounds -- you can also type the entire definition and then add the \def in front of it. Dec 29 '11 at 20:33
• Can someone confirm whether this is still an issue?
– Oded
Jul 24 '14 at 12:18
• @Oded It is; I tested it now. This answer by Davide Cervone describes how MathJax scoping begingroup... endgroup can be used to deal with leaking definitions, but implementing it would require some changes to SE code.
– user147263
Jul 24 '14 at 15:18
• Geoff Dalgas updated this to say status-completed, but didn't say why.
– MJD
Jan 27 '15 at 17:41

• Some way to reset TeX macro definitions (and ideally any other mutable state) back to its previous state after a Typeset call. It might be possible to hack this locally by poking into MathJax internals (pull a copy of the definitions from the TeX InputJax before calling Typeset and stick it back afterwards), but it would be much better to have an officially supported way to do this.