2
$\begingroup$

I know the general phenomenon is that rendering of previews differs from rendering of posts, but, presumably, the goal is to minimise unnecessary discrepancies—and that, in particular, non-esoteric TeX, in an "I know it when I see it" sense, that renders in an external compiler without special packages should render in posts.

The following equation appears in @SidharthGhoshal's answer to Is there a summation method where the divergent series $S = U_0+U_1+U_2+\dots$ converges to a finite value(V2)?:

U_n = M\left(c-\frac{1}{n+2}\right)-M\left(c-\frac{1}{n+1}\right)\label{1}\tag{$U$} = \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} -  \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} 
 = m_0 \left( \frac{1}{\sqrt{\frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{1}{\sqrt{\frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}}  \right) = m_0 c \left( \frac{n+2}{\sqrt{2c(n+2) -1 }} - \frac{n+1}{\sqrt{2c(n+1)-1}}  \right) =

I have to admit that I haven't been patient enough to count that braces and \left(\right) pairs match, but it seems to me, if they didn't, then this shouldn't render at all anywhere—and it renders just fine in preview:

Equation rendering in preview and in an external TeX compiler; but it doesn't render in the post:

Equation not rendering in post

Sometimes such errors can be fixed on refresh, but that doesn't seem to be happening to me.

$\endgroup$
5
  • 4
    $\begingroup$ The preview only users an answer. I would guess that the problem might be that both the question and the answer contain \label{1}\tag{$U$} - but the problem that the same label is used twice on one page only manifests when both the question and the answer are displayed. This is what I recently edited. $\endgroup$ Jul 26 at 5:25
  • $\begingroup$ This post on Mathematics Meta seems to be about a problem caused by the same thing: Equations not shown, as if there is a problem with MathJax. $\endgroup$ Jul 26 at 5:52
  • $\begingroup$ There is no point in the equation having a label at all, as it is never referenced (and there is no reason it ever should be, in such a short post). $\endgroup$ Jul 26 at 5:59
  • 1
    $\begingroup$ @EmilJeřábek, re, while each person has their own labelling preferences, I think that argument is easy to accept; but I think it is also probably orthogonal to the question—whether, as @‍MartinSleziak suggests, the problem is caused by the label probably has little to do with whether the label belongs. $\endgroup$
    – LSpice
    Jul 26 at 15:16
  • 1
    $\begingroup$ Thank you for asking this. I was wondering the same and never got around to it! :) $\endgroup$ Jul 29 at 21:01

1 Answer 1

4
$\begingroup$

This is a CW answer - for experimenting.

Here is the equation copy-pasted from the (current revision of the) post:

$$ U_n = M\left(c-\frac{1}{n+2}\right)-M\left(c-\frac{1}{n+1}\right)\label{1}\tag{$U$} = \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} = m_0 \left( \frac{1}{\sqrt{\frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{1}{\sqrt{\frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} \right) = m_0 c \left( \frac{n+2}{\sqrt{2c(n+2) -1 }} - \frac{n+1}{\sqrt{2c(n+1)-1}} \right) = $$

Here is the same question after omitting \label{1}\tag{$U$}

$$ U_n = M\left(c-\frac{1}{n+2}\right)-M\left(c-\frac{1}{n+1}\right) = \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} = m_0 \left( \frac{1}{\sqrt{\frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{1}{\sqrt{\frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} \right) = m_0 c \left( \frac{n+2}{\sqrt{2c(n+2) -1 }} - \frac{n+1}{\sqrt{2c(n+1)-1}} \right) = $$

And here \label{1}\tag{$U$} was replaced by \label{2}\tag{U}

$$ U_n = M\left(c-\frac{1}{n+2}\right)-M\left(c-\frac{1}{n+1}\right)\label{2}\tag{U} = \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} = m_0 \left( \frac{1}{\sqrt{\frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{1}{\sqrt{\frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} \right) = m_0 c \left( \frac{n+2}{\sqrt{2c(n+2) -1 }} - \frac{n+1}{\sqrt{2c(n+1)-1}} \right) = $$

When I copy-paste the very first equation once again - the one containing \label{1}\tag{$U$} - this one is not rendered correctly. Which suggests this might be some problem with duplicate label.

$$ U_n = M\left(c-\frac{1}{n+2}\right)-M\left(c-\frac{1}{n+1}\right)\label{1}\tag{$U$} = \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{m_0}{\sqrt{1 - 1 + \frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} = m_0 \left( \frac{1}{\sqrt{\frac{2}{c(n+2)} - \frac{1}{c^2(n+2)^2}}} - \frac{1}{\sqrt{\frac{2}{c(n+1)} - \frac{1}{c^2(n+1)^2}}} \right) = m_0 c \left( \frac{n+2}{\sqrt{2c(n+2) -1 }} - \frac{n+1}{\sqrt{2c(n+1)-1}} \right) = $$

$\endgroup$
9
  • $\begingroup$ "this might be some problem with duplicate label"—oh, that makes perfect sense! I was so focussed on the post in isolation that I forgot that labels are per-page things. It also makes sense of why things would be fine on preview—the 'other' U label isn't there yet. Thank you! $\endgroup$
    – LSpice
    Jul 26 at 15:14
  • 4
    $\begingroup$ I would encourage users to use more expressive labels (not just 1, for example). In fact, including their userID or something unique to them would help. E.g., \label{LSpice-1} rather than \label{1} would be a useful way to avoid label clashes. $\endgroup$ Jul 26 at 19:55
  • 3
    $\begingroup$ Of course, the \tag can be anything you want, it is the \label that is causing the expression to fail. $\endgroup$ Jul 26 at 23:43
  • 1
    $\begingroup$ @DavideCervone, re, I look forward to everyone labelling their equations LSpice-1. 😄 (@‍IosifPinelis has the interesting approach of numbering equations by 10s, in the hope of avoiding conflicts.) $\endgroup$
    – LSpice
    Jul 27 at 1:11
  • $\begingroup$ @DavideCervone I wonder whether \label{1} appears in some standard help file. Otherwise I can't understand why so many users are automatically putting it in all their tagged equations even though they do not use the \label-\ref facility at all. $\endgroup$ Jul 27 at 7:18
  • 1
    $\begingroup$ @EmilJeřábek, I am not able to find anywhere that that is suggested. But I suppose they are doing it to make the label match the tag, which they probably start at equation number 1 (even if other answers already include an equation numbered 1). $\endgroup$ Jul 28 at 19:56
  • 2
    $\begingroup$ @LSpice, no doubt you are right, now everyone will use LSpice-1 instead of 1. Sigh. $\endgroup$ Jul 28 at 19:57
  • 2
    $\begingroup$ @DavideCervone I almost never use \label in MathJax - so here I was basically just trying what works without really understanding what I'm doing. And this post was meant as a "sandbox" for testing - not as a genuine answer. Would you perhaps be willing to post an answer explaining at least basic dos and don'ts concerning \label, \tag (and maybe some related commands)? (Or maybe some brief explanation with a link to some documentation - if something suitable is available on mathjax.org or elsewhere.) $\endgroup$ Jul 29 at 5:10
  • $\begingroup$ Re, I second @‍MartinSleziak's suggestion/request. I'm not sure which answer would then be appropriate to accept, but I doubt @DavideCervone or @‍MartinSleziak would be much fussed either way. (Amusingly, I note that all of @‍DavideCervone's answers here are to my questions. 😄) $\endgroup$
    – LSpice
    Jul 29 at 22:31

You must log in to answer this question.

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