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.
\def
in front of it. $\endgroup$begingroup... endgroup
can be used to deal with leaking definitions, but implementing it would require some changes to SE code. $\endgroup$