# Problem with math rendering in a long post

I posted this answer, https://math.stackexchange.com/a/1944415/30391 , but the first eight display style equations are not rendered. Instead their LaTeX commands are shown in boxes. The equations were rendered correctly during the preview, and the problem is seen only after posting it.

I am not sure if this is only in my environment. I guess that my answer was too long.

I would appreciate if anyone could give me any hint for fixing the problem.

• This behaves quite curiously I copied your post to sandbox (here is the link and also link to the current revision.) Simply because experimenting there is probably better than in the post on the main. It is exact copy-paste of your source, but it renders there. (However, the first time after I posted it, no equation render for me.) – Martin Sleziak Sep 28 '16 at 3:36
• Isn't the problem simply that on the same page (once in the question and once in the answer) you use \label{1} to \label{8} twice? (In LaTeX you would get error saying something about duplicate labels, I am not sure what MathJax is supposed to do in such case.) I tried to change in the answer \label{1} to \label{1a} and \ref{1} to \ref{1a} in all occurrences. Now the first equation renders (at least on my computer). – Martin Sleziak Sep 28 '16 at 3:43
• Thank you Martin. I saw your edit of my answer. The first equation is indeed displayed correctly in my environment, too. You are right that I used the same labels in the question and the answer. – norio Sep 28 '16 at 3:46
• The same problem was raised in comments to this answer on meta.MO. I am not sure whether this should be considered bug or whether it is the intended behavior. – Martin Sleziak Sep 28 '16 at 3:47
• Thank you very much for your kind help and information. I didn't know that the labels can not be overlapped between a question and an answer. No matter whether it is a bug or not, I can deal with it from now. – norio Sep 28 '16 at 3:57
• I may be totally off, but this may be something similar to what was discussed here. Labels may (?) behave like macro/environment definitions. They are valid for the entire page, and will affect ALL the answers on that page (not just your own). Why wouldn't they? It's not like you would normally limit their scope here. I am a bit cautious in using TeX for things other than just rendering formulas, but that is largely due to my lack of study. – Jyrki Lahtonen Sep 28 '16 at 4:19
• @JyrkiLahtonen Right. Labels seem to have the scope over the entire QandA page. And, I think it is good that I can refer to an equation in another answer or in the question. One just needs to know this scope in order to be carefully label his own posts. – norio Sep 28 '16 at 4:26
• There are good and bad sides to it. Definitions someone else makes may come as a surprise. Also, I don't know what happens, when the order the posts are displayed in changes. Say, if somebody else posts an answer to that question as well, and it happens to get more upvotes than yours. Then (to a user who wishes to see the posts sorted according to votes) whatever definitions that post made will trump your definitions! Or cause something to go wrong. I simply don't know (speculating here), so I'm hesitant to use features of TeX that rely on the order of posts. – Jyrki Lahtonen Sep 28 '16 at 4:36
• From the technical end, a label ends up generating a DOM element with a matching ID and IDs have to be unique. MathJax checks that an id is unique in the page so that a reference can resolve correctly; this also matches LaTeX's behavior. – Peter Krautzberger Sep 28 '16 at 6:18
• I think it would be nice if each of the question and answers has its own name space for the labels, and if an answer can use other name spaces by explicitly specifying it. For example, an answer can define a label 3 and refer to it as it is done; it can also refer to a label 3 defined in another answer a58bx1 by a58bx1.3, in much the same way as in programming languages like python, C, C++, and java. – norio Sep 28 '16 at 14:20