8

A follow up of What delimiters work for MathJax?: the question Vector convolution? on MathOverflow contains some non-standard MathJax delimiters: \begin{equation} and \end{equation}. They are recognized on the Q&A page and correctly typeset, but not on the revision history and the suggested edit pages:

enter image description here

Note that the other equation, which uses dollar signs, is treated correctly.

1 Answer 1

8

The issue there is not that \begin{equation}...\end{equation} is not recognized, it is that the two equations involved (the original in red and the new in green) both include \label{1}, and so when the second one is typeset, it generates a duplicate label error, and the expression is shown untypeset (due to the use of the noErrors extension that suppresses the error messages). So this is the correct behavior in this instance.

13
  • 2
    That's intriguing. But the end-result is not really correct, then; what this means is that the two sides of the diff need to be processed separately, to avoid such undesired interactions. (I imagine things may get even more weird if user macro definitions in the two sides clash with each other.) Feb 4 at 18:41
  • 1
    @EmilJeřábek I am the maintainer of the MathJax FAQ on two of our technical mathematics sites, and can vouch for Davide; the developer of MathJax.
    – Rob
    Feb 4 at 22:12
  • 3
    @rob, Thanks for the support. I think what Emil meant is that the end result of the difference page isn't correct, and he is right about that. I'm not sure that there is a reasonable way to resolve that particular issue, however, without more MathJax-specific code that would reset the label data between the two panes, and use \begingroup and \endgroup to isolate any macro definitions. That could be done, but would take some MathJax knowledge to implement. Of course, there are other issues, like when coloration appears inside the math, it prevents MathJax from displaying it. Feb 4 at 22:19
  • Davide, yes but the issue is: "did you answer the question asked correctly", not whether MathJax or the mixed implementation of it on Stack Exchange exposes other bugs. --- Perhaps it's best (here at Stack Exchange) to always surround our MathJax with $ or $$ regardless of whether it is actually necessary (in the case of equation's markup which allows using only '\\(', '\\)' or '\\[', '\\]' and other delimiters).
    – Rob
    Feb 4 at 23:21
  • 1
    @DavideCervone I’m not familiar with the inner workings, but MathJax is already setup on this site in such a way that individual answers are isolated from each other. I’d assume it shouldn’t be too much additional work to isolate the diff sides in a similar way. Feb 5 at 7:36
  • 1
    @Rob How would that accomplish anything? As Davide’s answer explains, the issue is caused by clashing labels, not by the choice of delimiters (as the question originally surmised). MathJax allows labels even in equations delimited by $$ ... $$. Feb 5 at 9:39
  • 3
    Oh, now I see that the existing isolation of answers only applies to macro definitions (using \begingroup and \endgroup), but not to labels: if two answers use the same equation label, the second one will not render correctly. So resolving the issue with labels would require more work, indeed. I guess that duplicate labels in answers are very unlikely to occur in the wild, and easy to work around by renaming the labels; thus side-by-side diffs are the only place where this is actually a problem. Feb 5 at 10:53
  • That's not always the case, 2 examples: math.meta.stackexchange.com/a/29621/510296 and math.meta.stackexchange.com/questions/3667/… - if one question or answer does something it can affect all the MathJax on the page, it's not always limited in scope to a single post.
    – Rob
    Feb 5 at 12:21
  • 1
    @Rob your link to the answer on Mathematics Meta says that answers and comments are now isolated by \begingroup…\endgroup, and the link to a comment on the same site doesn’t seem particularly relevant to me…? Feb 5 at 12:34
  • 2
    @rob, in terms of answering the question, the OP suggested that the issue they were having is due to MathJax not recognizing the delimiters. That is not the case, and my answer points that out, and indicates what is actually the cause of the output. It seems to me that that does answer the question. This is not describing an additional bug, this is the true cause of the bug reported. Further discussion of delimiters seems to miss the point entirely. Feb 5 at 13:00
  • 2
    @TheAmplitwist, I believe rob's first link is really about the comments, some of which point out situations where definitions are not isolated and affect the whole page (in particular in titles and in the hot questions list). But, like you, I'm not sure how the second link pertains. Feb 5 at 13:03
  • Davide, I try to include links when I offer information; it's up to people following those to read the surrounding text and apply the information. Often the replies are without links, and then I reply with yet more links, followed by further pings without a link to support what they wrote (@TheAmplitwist). -- Davide, here is a comment by you saying that a command affects the whole page - I can't spend a few 100 worth of time to find the perfect response to everything, always.
    – Rob
    Feb 5 at 13:48
  • 3
    @rob, OK, I see what you were trying to get at with that comment now. Yes, loading an extension is global, and not something that can be isolated to a single post. I'm afraid the linked comment didn't carry that connotation for me (nor did the surrounding text, which is about what extensions to have pre-loaded on all pages). Of course, both that link and your new one citing me predate the use of \begingroup...\endgroup on SE, and so in those days, everything like that would affect the whole page. But you are right, those are not affected by \begingroup...\endgroup in any case. Feb 5 at 15:07

You must log in to answer this question.

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