# Problem with posts and comments relying on macros defined elsewhere

MathJax supports possibility do define macros. (Using \newcommand, \DeclareMathOperator, \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 \begingroup .. \endgroup. Now the Stack Exchange software encloses each post/comment in \begingroup .. \endgroup.

This was changed relatively recently. (In the past this was not done automatically - so the posts contained \begingroup .. \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 \newcommand and 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.

You can find also further examples in this chatroom, if you search for mathoverlow, mathoverflow.net or the messages tagged mathoverflow.

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:

• For the examples you give, I see the possibility where the macro names are better than the symbols they might define for communication, so I would leave those alone. In general, I would use this post as a place to list problem examples for which a strong argument for change should be made. If there are a lot of such, then we can consider automated editing or even editing. Gerhard "Prefers Clarity Over Font Choice" Paseman, 2019.01.30. – Gerhard Paseman Jan 30 at 15:57
• @GerhardPaseman Just to make this more clear, the way this post/comment is displayed now is different from what the OP intended - since the macros worked at the time of the posting. (Before the question was enclosed in a separate begingroup..endgroup.) – Martin Sleziak Jan 30 at 16:07
• Yes, and in some cases the intent of the original poster is clear enough that someone can make changes respecting that intent. Most of the time we can at best guess. My point is that, except for extreme cases, we should not even guess or edit. Let the original poster change it or request change. Gerhard "Sometimes Inaction Is The Best" Paseman, 2019.01.30. – Gerhard Paseman Jan 30 at 16:46
• @GerhardPaseman Actually, your comment seems to me as an argument in favor of editing. You say that we should respect the posters' intent - and the intention was very likely for the post to look the way it looked after it was posted (i.e., with the macros rendered), not influenced by later changes in the software. – Martin Sleziak Jan 30 at 16:51
• Perhaps. If the intent was to use the macros as a convenience and the side effect of the changes improves the clarity of the communication, it might also be the posters intent to preserve the current rendering. In your last comment, you are guessing at the posters intent. (I am also guessing.) Even though you may be right, you also assume that we can reconstruct the original presentation. I do not assume that. I assume that if it matters to the poster, they will ask. They will benefit from seeing this meta post. Gerhard "Thanks For Presenting The Issue" Paseman, 2019.01.30. – Gerhard Paseman Jan 30 at 17:04
• How many posts have you seen affected by this change? I suppose I'm suspicious that so long as users are only passively editing such posts or flagging comments as they come across them, there won't be a flood of flags to mods' inboxes, or of bumped questions to the front page. – Mike Pierce Jan 31 at 23:18
• @GerhardPaseman It would be a bit tougher, but an editor could find the place on the page where the \newcommand macro is defined (it's gotta be somewhere on the page, right?), and just copy the definition of that macro into the post where the errors are occurring. This would preserve the author's original rendering without guesswork. I can't imagine a user of one of these affected posts wanting their post to have red-highlighted errors rendered in it, although you are correct that that's only an assumption. – Mike Pierce Jan 31 at 23:27
• @MikePierce I do not know how many such posts and comment are there in total - since I cannot think of an easy how to search for all instances of this problem. The examples from MathOverflow that I have found so far are listed in chat - there is not too many of them. (On Mathematics you can find more such cases - some of them have already been edited. But that it very natural, considering that MO is about 10-times smaller.) – Martin Sleziak Feb 1 at 12:27
• One possibility would be to put \endgroup just before the definitions and \begingroup right after, which would make the definitions global again (unless SE has modified the begingroup extension to prevent that). I suspect some will not like this idea, as it circumvents the intent of using begingroup, but it would help reduce the number of posts that need to be modified. Then again, it might be something that SE disables in the future, and we'd be back at this point again. Just a thought. – Davide Cervone Feb 1 at 14:21
• @DavideCervone If I understand your solution correctly, it would need some edits anyway - I think that it's better to make edits which are less likely to break things in the future. (Although I understand that some advantage to this would be that editing comments would not be needed.) – Martin Sleziak Feb 1 at 14:55
• @MartinSleziak, yes, there are still some edits needed, but fewer than if you had to copy global definitions to all answers and comments that needed them. And, as you say, that could avoid the problems inherent in editing comments. – Davide Cervone Feb 1 at 15:53
• @DavideCervone One additional problem with using the workaround suggested in your comments is that it might be seen as intentionally disrupting the intended usage of MathJax and potentially lead to some problems. Quote of a SE employee: "The only way this'd happen is from someone trying to mess with the page and I'm okay with leaving that up to being edited out and the user potentially being suspended if they keep at it. " – Martin Sleziak Apr 12 at 15:32

This is a community wiki answer intended as a place to collect examples of posts and comments which are examples of the described problem. Feel free to add further examples if you find some more. (But let's restrict this to examples where the problem was caused by the recent software change described in the question - not those posts/comments where the poster simply made a mistake used a macro that wasn't defined anywhere.)

This answer is posted partially as a response to the comments asking how many "problematic" posts and comments are there. (Of course, without some systematic way to search for them, the list is very likely to be incomplete.)

• Free subquotient of Galois representations coming from Hida theory - the macros \Frob and \Q are using in this answer, defined in another answer.
• Is there a subset of the natural number plane, which doesn't know which of its slices are arithmetic? - the answer uses \N, which is defined in the question.
• Is an ordinary scheme in Borger's Absolute Geometry the same as a “scheme over F1” with a map to Spec(Z)? - the answer uses \Z, which is defined in the question.
• Is $$\delta(df \wedge df)=0$$ an Euler-Lagrange equation? - the answer uses several macros which are defined in the question.
• Curves over number fields with everywhere good reduction - the macro \Q is defined and the question and used in the answer (and several comments)

• @EhudMeir, indeed, my example with the determinant was an example of something else! :-| I'll correct it. if I start with with a $$2$$-cocycle $$\alpha:G\times G\to\CC^\times$$, fix $$g\in G$$ and let $$\beta:h\in G_g\mapsto \alpha(g,h)/\alpha(h,g)\in\CC^\times$$, I am only being able to prove that $$d\beta=\beta^2\smile\beta^2$$, no that it is a $$1$$-cocycle on $$G_g$$; is that construction treated somewhere? (I can do it if $$\alpha:G\times G^{\ad}\to\CC^\times$$ is a $$1$$-cocycle giving an element of $$\Ext^1(\ZZ G^\ad,\CC^\times)$$, though: is that what you meant?) A cohomology class associated with a complex representation of a group
• Hartshorne defines a smooth morphism for schemes of finite type over a field $$k$$. Moreover, he defines "smooth of relative dimension $$n$$," not just smooth, requiring each $$\mathfrak X_{\mathfrak p} \times_{\Spec \kappa(\mathfrak p)} \Spec \overline{\kappa(\mathfrak p)}$$ to be equidimensional. Also, I wasn't sure Bruhat-Tits was using standard definitions, so I wanted to clarify what they said. Clarification on the definition of a smooth affine scheme over an integral domain
• Martin, ok. Then I made a mistake somewhere. Actually I am very interested in an example of a non-noetherian ring $$A$$ for which $$\Spec A$$ is discrete. Clarification on the definition of a smooth affine scheme over an integral domain
• Thans, this really helps. I guess I can now figure out myself whether things like $$\lim_{i \in I} \Spec R_i \ne \Spec \colim_{i \in I} R_i$$ are true. Is lim R_i = O(colim Spec R_i) true for finite (co)limits?
• Also, I thought that $$(f_*\oO_{\Spec B})_\mf{p} = (\oO_{\Spec B})_\mf{q}$$ because of the way he defined the morphism of sheaves $$f^\sharp$$ and the local homomorphisms $$\varphi_\mf{p} : A_{\varphi^{-1}}(\mf{p})\rightarrow B_\mf{p}$$. Ie, he said "The induced maps $$f^\sharp$$ on the stalks are just the local homomorphisms $$\varphi_\mf{p}$$", but these local homomorphisms are only defined for $$\mf{p}\in\Spec B$$, whereas they should be defined for all $$\mf{q}\in\Spec A$$, so it seemed like he was saying that as $$\mf{p}$$ ranges over $$\Spec B$$, $$f(\mf{p})$$ ranges over all of $$\Spec A$$, which is false.. morphisms of affine schemes question
• $$\newcommand{\fF}{\mathcal{F}}$$ Sorry to come back to this, but after rereading Hartshorne's definition of a morphism of locally ringed spaces, that even though as $$V$$ ranges over all open nbhd's of $$f(P)$$, $$f^{-1}(V)$$ ranges over a subset of the nbhd's of $$P$$, he still claims that $$\lim_V \oO_X(f^{-1}(V)) = \oO_{X,P}$$. (In your addendum to your original response, you said in general this limit, which you wrote as $$(f_*\fF)_{f(x)}$$ is not ismorphic to $$\fF_x$$) morphisms of affine schemes question
• You're right, that was misleading. Let me restate the remark in a more useful form. First, $$m$$-equivalence is determined by constant-size neighbourhoods iff $$(\Z,<,A,S,P)$$ has quantifier elimination. Now, for any set $$A$$, the following are equivalent: (1) $$(\Z,<,A,S,P)$$ has quantifier elimination, and no definable elements; (2) every finite string that occurs in $$A$$ occurs in all sufficintly long intervals. It's not immediately obvious that there are nonperiodic sets $$A$$ with this property, but one such is the Thue-Morse sequence, extended to $$\Z$$ by putting $$-n-1\in A$$ iff $$n\in A$$. So, .. Is there a Leibnizian model with no definable elements, in a finite language?
• Can anyone give an elementary forcing-free proof that if we choose $$A$$ by coin flips, then almost surely $$\langle\Z,<,A\rangle$$ has no definable elements? Is there a Leibnizian model with no definable elements, in a finite language?
• If CH holds, then $$\R$$ is not $$(\omega_2,\omega_3)$$-compact, by the argument in your post: consider the theory of $$\omega_2$$-many distinct constants. And the case $$2^\omega=\omega_2$$ is handled by my argument. So we have only the case $$2^\omega\geq\omega_3$$ remaining. What kind of compactness does "expanding $\mathbb{R}$ by constants" have?
• So you mean $$X=\mathfrak{sl}_2(\C)$$ with $$G=\mathrm{SL}_2(\C)$$ acting on $$X$$ by conjugation (i.e. $$g.x = gxg^{-1}$$) and the points are the semisimple element $$h=\begin{pmatrix}1&0\\0&-1\end{pmatrix}$$ and the nilpotent $$x=\begin{pmatrix}0&0\\1&0\end{pmatrix}$$. Is that correct? I am confused because my calculations yield $$\overline{G.x}=X$$, while $$G.h=\C h$$. About the strength of representation-theoretic obstructions for orbit closure problems
• According to this document, Fontaine's proof also shows works «for “small” fields $$K$$, e.g. $$\Q(\zeta_n)$$ for $$n \leq 7$$» Curves over number fields with everywhere good reduction
• I am aware of this (I already linked this question in my post). Moreover, for $$g=2$$, it is claimed here that the curve $$y^2=x^5-1$$ has good reduction everywhere over $$K = \Q(i, \sqrt[5]{2}, \sqrt{1 - \zeta_5})$$. Curves over number fields with everywhere good reduction
• Thank you! I shouldn't have missed this corollary in Fontaine's paper. Still my first question remains. Moreover, one could wonder about the assertion $$A_K$$ for $$K=\Q(\sqrt 2)$$ or $$K = \Bbb Q(\sqrt{-2})$$ (notice that those fields have no non-trivial unramified extension, as the four number fields given in Fontaine's result). At least, it is known that there is no elliptic curve over $$\Bbb Q(\sqrt 2)$$ (or over $$\Bbb Q(\sqrt{-2})$$) with everywhere good reduction. Curves over number fields with everywhere good reduction
• I have mentioned already in the question this chatroom. You can see there how I searched for these examples - and the same room can be used for any discussions related to this issue. – Martin Sleziak Feb 7 at 13:44
• BTW when trying to find these examples, I was a bit surprised to see that many people often use macros (perhaps out of habit) without noticing that the macro is undefined and it does not render in the comment (or in the post). – Martin Sleziak Feb 7 at 14:30