10
$\begingroup$

Today, I wrote an answer to this question. After posting the answer, it looks like this:


3


As you can see, the equations $ ( 1 ) $ and $ ( 2 ) $ are not shown properly, while equation $ ( 0 ) $ is. The confusing part for me is that while I was writing the answer, the preview under the box I was writing in, was alright. In fact, it still is, when I try to edit the answer:


4


This is the second time I have this kind of problem on MSE. I need to go through my previous post to find that one and give a link to. But the thing is, last time that this happened, I tried editing the code I wrote for the equation so that it may looked as it was intended to, with no avail. I tried putting braces around the expressions after \text, \tag and \label, but it didn't work. And one thing is that I've written many many posts with this style, and had no problem except in these two posts.

I want to add that I remember there was something different about the preview and the actual output of tag infos, when I was editing them a long time ago. I can't remember what exactly that was, and whether it was related to this one or not. But I think it was the other way around: the preview had problems, while the actual output was alright; so I let that alone and forgot about it, until now.

So what is the problem exactly? Is it something with the implementation of MathJax on MSE? Is it something with my browser for example? Or what? Why is it different in the preview and in the post?


EDIT:

This is the other post I referred to. As @MartinSleziak suggested in the comments below, the problem was due to the fact that the same label was used for another equation in another post. This time, it wasn't in the question, but in another answer. I edited the other answer and changed the label, and everything was displayed normally after that.

$\endgroup$
7
  • 2
    $\begingroup$ Could the problem be caused by the fact that \label 1 is used both in the question and in the answer. (As somebody pointed out in chat, using the same label twice can cause the problem.) However, I wasn't able to fix the post after trying some changes. (I have noticed a similar problem in the answer to this - again it uses the same label as the question: $A\cos(\theta) + B\sin(\theta)$ for complex $A,B$.) $\endgroup$ Commented Dec 1, 2020 at 14:11
  • $\begingroup$ I've had the "preview doesn't work, but posted it does" problem you describe, but not recently. And I'd also heard it was due to the code following two different routes. I'd also noticed that the preview failing would be fixed if I granted Javascript-running permission to a google domain (I think it was googletagservices.com); I use the NoScript browser extension. I was going to post about it, but it's not realistic to expect selective Javascript blocking to be supported. $\endgroup$
    – JonathanZ
    Commented Dec 1, 2020 at 14:15
  • 2
    $\begingroup$ I have edited both answers mentioned here in such way that the same label isn't used in the question and in the answer. As I said before, I have followed the advice from chat. Perhaps somebody can check whether the answer are displayed correctly. (When I view them, they seem to be ok. Sorry for muptiple edits.) $\endgroup$ Commented Dec 1, 2020 at 14:37
  • $\begingroup$ @MartinSleziak Thank you very much. It is displayed correctly now. Your comments seem to be a perfect answer for my question here. If you post them in an answer, I'll accept it. $\endgroup$ Commented Dec 1, 2020 at 15:12
  • $\begingroup$ @MartinSleziak: I also see the Answer's equations correctly displayed, thanks to your edits. $\endgroup$
    – hardmath
    Commented Dec 1, 2020 at 18:53
  • 1
    $\begingroup$ I upvote rarely a question containing text image(s) on math.SE, but your question merits that. $\endgroup$ Commented Dec 2, 2020 at 10:20
  • 1
    $\begingroup$ @MohsenShahriari As I said, I simply followed a suggestion from another user in chat. I don't feel competent enough to post a reasonable answer. If you consider the things mentioned here and in chat as a sufficient answer, feel free to summarized them and post an answer yourself. (I will add that this post by Davide Cervone was also mentioned in chat: Using labels with mathJax?) $\endgroup$ Commented Dec 2, 2020 at 13:53

2 Answers 2

4
$\begingroup$

Just a comment. $$ f(x) + f(x + f(y)) = y + f(f(x)+f(f(y))) \label0 \tag0 $$ Lorem ipsum Reference to \eqref{0} is easy, use \eqref{0} for an equation \label0. $$ f(f(x)) = f(f(0)) - x. \tag{renamed to eqn1} \label{eqn1} $$ In case of error in \eqref{eqn1}, just refresh. If a refresh doesn't solve your problem, that's probably two equations (written by different authors) sharing the same label. In this case, try a more meaningful label, like label{eqn1}.


label collision

$\endgroup$
4
$\begingroup$

$$ f \big( f ( x ) \big) = f \big( f ( 0 ) \big) - x \text . \tag1 \label1 $$ now 2 $$ f \big( f ( x ) \big) = f \big( f ( 0 ) \big) - x \text . \tag2 \label2 $$ now without "label" $$ f \big( f ( x ) \big) = f \big( f ( 0 ) \big) - x \text . \tag3 $$

Everything goes back to normal if I reload the page. Strange. Personally, I would never use "label" in MathJax.

$\endgroup$
3
  • $\begingroup$ That's true. I've used \label many many times like that, and it has actually worked. You can see that by checking out almost any of answers I've written. I just reloaded the page, and it went back to normal. But in these two particular posts of mine, it didn't. And the more strange fact is that this didn't happen to all the equations, but only some of them. $\endgroup$ Commented Dec 1, 2020 at 12:00
  • $\begingroup$ One can simply number an equation, using \tag 1 \tag 2, etc. $\endgroup$
    – amWhy
    Commented Dec 2, 2020 at 20:19
  • $\begingroup$ @amWhy, re, if an equation is worth numbering at all, then it's probably worth referencing, and \label makes that easy to do with \eqref{0}, as in @‍GNUSupporter8964民主女神地下教會's answer. But, of course, a descriptive label is always better than a particularly vulnerable-to-collision bare numeric label. $\endgroup$
    – LSpice
    Commented Jul 26, 2023 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .