MathJax supports possibility do define macros. (Using
\def, etc.) They are certainly useful, however sometimes they can cause minor problems - for example clash of macros defined differently in two different posts. Therefore it is recommended to enclose them within
\endgroup. Now the Stack Exchange software encloses each post/comment in
This was changed relatively recently. (In the past this was not done automatically - so the posts contained
\endgroup only if it was included manually by the poster or editors.) Here is copy of the relevant part from Recent feature changes to Stack Exchange:
2019-01-14: On sites with MathJax enabled, the effect of
\newcommandand similar directives is now scoped to individual posts and comments rather than the entire page. (Bug report on Math.SE's meta)
One side effect of this change: In the past some users might have posted answers relying on macros defined in the question or comments relying on macros defined in posts. In such cases, the macros will no longer be rendered correctly. (Although they were working fine at the time of the posting.) The question is what to do with such posts and comments.
- I suppose that for posts the answer is simply to edit such posts - with the usual caveat that we should avoid bumping many old posts at the same time.
- However, comments can only be edited by mods. (Possibly in some cases the poster would be able to delete comment and post a new one without disturbing the flow of the conversation - but if the comment is mid-conversation this would not be ideal.) Should we simply flag such comments and ask the moderators to edit?
I certainly do not want to cause flood of flags for the moderators. But I will assume that there will not be too many such comments, so most likely this will not be a major problem. But still it would be good to have confirmation whether flagging is the way to do.
EDIT: Of course, there might be even cases when the comments cannot be fixed - in the cases when the edit (either expanding the macro or including the definition directly into the comment) would lead to number of characters above the allowed length of a comment.
I will add at least on example illustrating this problem - this answer (and a snapshot from Wayback Machine). I have also included a screenshot below. And here is also an example of a comment with this problem (Wayback Machine) - again I have added also a screenshot below.
EDIT: One of the commenters asks how many comments/posts were affected by the change. I do not have an easy way how to find all content affected by this. As you can see in the chatroom I linked to, I searched for some specific common names (\Spec, \Hom, \Ext, \norm), etc. I was able to find some examples but not many of them. (Most what I found is listed in today's chat transcript. Of course, feel free to use the linked chatroom if you have additional suggestions how to search for such posts.)
I was surprised that I found several posts and comments where somebody used a macro which wasn't defined anywhere on the page. In the other words, the macros are not rendered, but it was not caused by the recent change described here - it was a mistake made already when posting. (I was surprised mainly because I expect a typical MO user to have some experience with LaTeX. But I have also made many mistakes in my comments and posts which I would have noticed if I checked them more carefully right after posting - so such things do happen.)
Screenshot of a post:
Screenshot of a comment: