# The scope of \newcommand changed

It was pointed out earlier today on chat, by Martin Sleziak, that the scope of MathJax new commands changed at some point in the (recent?) past: it was switched for Math SE in January of last year and on this site at some point in the intervening months.

The short of it is that answers now start and end with

<span class="d-none">$$\begingroup$$</span>


and

<span class="d-none">$$\endgroup$$</span>



This is Good Thing, and indeed something we've complained about before. However, it does also mean that answers that used commands defined in the question may now be broken, and it'd be good to have a thorough search for them and implement any fixes that may be required.

As such, I'm using a SEDE query, Answered questions with LaTeX \newcommand's , which lists all the relevant questions, in case anyone wants to help me look through them.

• Probably it is worth pointing out that not only answer, but also some comments are broken because of this. (The comments are enclosed in begingroup..endgroup, too.) I have listed some examples from this site in chat. – Martin Apr 1 at 13:07
• @Martin All the more reason for visual inspection, then. – Emilio Pisanty Apr 1 at 13:10
• That list is begging for a script that checks for what the \newcommand defines in the question and then searches the answers for it, and then (over time, like 1 or 2 per day) automatically edits the answer(s) as needed. Along the lines of the broken-image-link fixing script. Let me see if I can find somebody who has something like that up and running already. – tpg2114 Apr 1 at 13:24
• @tpg2114 it's a hundred questions or so. The time spent writing that script is more than it takes to inspect them manually, particularly since the errors are helpfully marked in red by mathjax. – Emilio Pisanty Apr 1 at 13:25
• @EmilioPisanty Okay, dealer's choice there. We might have different thresholds for that tradeoff :) – tpg2114 Apr 1 at 13:28
• @tpg2114 Well, I just went through all of 2016-2020, whereas on the script route I think I'd only now be beginning to unpack the data-dump xml within Mathematica. – Emilio Pisanty Apr 1 at 13:32