# Should I fix my 175 posts that use \newcommand without \begingroup?

A little over 4 years go I discovered that MathJax supports the $\LaTeX$ command \newcommand, and started to use it in my own answers and questions: this makes certain repetitive things so much easier to write.

In the meantime I've done this in 171 answers, 4 questions, and 11 comments.

(As a side note, currently I'm mostly using these for making it easy to write proofs and calculations in a 'calculational style'; see, e.g., EWD1300. A gist which I use as a template is here.)

However, I've recently discovered that \newcommand is not without its disadvantages: its scope is the rest of the math.se page on which it occurs. This means that my posts could be affecting other people's answers and comments.

I'd like to fix this.

There is a simple way to fix this, as explained in this answer to the above question and elsewhere: surround such posts with  $\require{begingroup}\begingroup$ ... $\endgroup$ 

(My first example can be seen in the source of this answer of mine.)

And I'm perfectly willing to go through all of the above posts, and apply this fix.

However, a disadvantage is that all these posts will suddenly jump to the top of the 'active' lists, for no good reason. That's probably considered bad form. (And there is no way to indicate 'trivial edits', or is there?)

Another disadvantage is that occasionally people have used a \newcommand of mine in a comment on that post. So using begingroup would make those start to fail.

Finally, the actual chance of having a conflict is low, except in those cases where I've used something like \newcommand{\equiv}{\Leftrightarrow} to redefine a predefined MathJax command. So going back applying this fix might not be worth it.

So my question is: Should I fix this?

• – Trevor Gunn Aug 8 '17 at 19:04
• I mean, if you'd like to fix it, don't let us stop you. – Simply Beautiful Art Aug 8 '17 at 21:58
• Actually, no, don't fix it, meaning don't fix it all rapidly, in a short period of time; that's an awfully large number of posts, that if edited within too short of a period of time, could risk an unwelcome reception. Maybe edit once-a-day edit, over the long haul...editing would be fine. But doing so in abundance, in the short term, would be very annoying, and perhaps even suspect. – Namaste Aug 8 '17 at 23:38
• I think you should use a practical approach. You already mentioned that tha chance of having a conflict is low. So I think you could identify the pages where there is a possible conflict because you redefined a predefined MathJax command. For this pages you check if there is actually a conflict. If so, you should edit it otherwise you can ignore it (of there are many) because the chance that there will be added new answer that will have a conflict is rather low. – miracle173 Aug 9 '17 at 12:37
• Another alternative: only fix it if you discover that it affects other answers that have been given. Sure, in theory it's possible to happen on any of the posts, but in reality it will probably never come to be a problem in most of them. And I second the advice amWhy gave above about not doing them wholesale all at once, in any case. – rschwieb Aug 9 '17 at 13:02
• My general advice: edit at most three dormant posts per day. Of course for any of those posts which you edit for some other reason, you should do this edit at the same time. – GEdgar Aug 9 '17 at 13:18
• The main reason I suggested "No, don't fix it" (too rapidly) is largely due to the fact that no one should do too much editing in too short of time, given that each and every edit of a question or of an answer triggers it's reappearance at the top of the "active questions" board, ust as you've noted. I've yet to see a complaint from anyone, any user to the effect that they have been "adversely" affected in your use of "\newcommand". Perhaps, you're "making a mountain out of a mole hill." However, Kudos to you, for asking on meta about your options, and being open to suggestions. – Namaste Aug 9 '17 at 17:04
• Props for asking!!! I also suggest that you keep the bursts of edits short. Take your time :-) – Jyrki Lahtonen Aug 9 '17 at 20:14
• Why not replace all \newcommand s with \providecommand ? – MCCCS Aug 15 '17 at 13:18
• You can ask SE to edit the post for you, if you can offer a programatic solution. – Braiam Aug 22 '17 at 18:56