Today I ran into the specific MahJax problem for which I cannot find the cause.

Interestingly, if this Mathjax syntax somehow works in the Q&A area, it definitely doesn't work in the comment section. (I tried many times)

Now one more interesting problem than that is that the MathJax syntax I mentioned works "completely randomly" without my intervention, or it doesn't work. The only thing I can do is refresh the page $10-15$ times.

As soon as the specific Mathjax syntax I mentioned runs, if the page is refreshed, unfortunately syntaxis won't work again.

Here is the MathJax syntax that "randomly works or doesn't work":


Well here it didn't work either...

Here are the images I took:

enter image description here

enter image description here

What is the source of the problem? I am not a computer user.

  • $\begingroup$ (Not an answer, but your post is a good example for this question.) $\endgroup$
    – vitamin d
    Mar 26, 2021 at 1:31
  • 2
    $\begingroup$ Not an answer but perhaps you are interested in \nLeftrightarrow$\nLeftrightarrow$ and \nRightarrow$\nRightarrow$ $\endgroup$ Mar 27, 2021 at 5:45
  • 1
    $\begingroup$ @CalvinKhor also $$\not\Longleftrightarrow$$ but seems not very good... $\endgroup$ Mar 27, 2021 at 5:46

3 Answers 3


You need to add $\require{cancel}$ to your post to be able to use it, $\require{cancel}\cancel\Longleftrightarrow$ will produce $\require{cancel}\cancel\Longleftrightarrow$.

  • $\begingroup$ (+1)So how can you explain if it works randomly?with my syntax $\endgroup$ Mar 25, 2021 at 14:20
  • 2
    $\begingroup$ It might loaded on some pages? $\endgroup$
    – Asaf Karagila Mod
    Mar 25, 2021 at 14:21
  • $\begingroup$ Important thing, we fixed the problem. But I would like to know why this syntaxis is different. Very interesting. $\endgroup$ Mar 25, 2021 at 14:24
  • 3
    $\begingroup$ @lonestudent it's an extension of MathJax, not the basic package. In some circumstances it may still be available due to use elsewhere on the page (although my understanding is that the scope of MathJax extensions and definitions is meant to be limited to the applicable block). $\endgroup$
    – Joffan
    Mar 26, 2021 at 23:51
  • 7
    $\begingroup$ I wonder whether the presence of \require{cancel} in one posting on a page can cause the \cancel{} command to work in other postings on the same page. $\endgroup$ Mar 28, 2021 at 4:09

$\def\niff{\iff\kern-1.75em/\kern1.25em}$ This method, using the \cancel macro from the package cancel, seems not to render the cancel stroke in the correct colour. Does that package always render the stroke in black? At any rate, it is practically invisible on a black background, and its only effect is to obliterate some of the symbol it is meant to be cancelling.

I instead suggest \iff\kern-1.75em/\kern1.25em within a MathJax expression. That bit of MathJax is rather bulky if you want to typeset that symbol more than once, so you could define a MathJax token for it, for example by $\def\niff{\iff\kern-1.75em/\kern1.25em}$. You may then write $P\niff Q$ for $P\niff Q$ or $1\niff2$ for $1\niff2$.

(Earlier, in this question, I had based my definition of \niff on \Longleftrightarrow as that had already been mentioned in this question. But a comment by Calvin Khor to this answer to another question on a similar subject pointed out two advantages of \iff over \Longleftrightarrow: appropriate spacing and a name which suits what the symbol means. I accordingly use \iff.

Just as a check to see if the spacing looks right: the next line below uses \iff and the line below it uses my \niff defined above.

$\begin{gather} P\iff Q\\ P\niff Q \end{gather}$

  • 1
    $\begingroup$ Doesn't look very good to me. The slash should be in the middle of the arrow, but I'm seeing it way over at the left end instead. $\endgroup$ Mar 28, 2021 at 21:40
  • $\begingroup$ @GerryMyerson I see you're right -- trying it in TeX and magnifying x4 showed that I was about .05em off. $\endgroup$
    – Rosie F
    Mar 29, 2021 at 5:23
  • $\begingroup$ I'm still seeing it way over to the left. $\endgroup$ Mar 29, 2021 at 5:50
  • $\begingroup$ What's a macro? $\endgroup$
    – user71207
    Mar 30, 2021 at 11:40

Testing @MichaelHardy's question about whether \require{cancel} in one post enables it in others. I assume it's present in @AsafKaragila's post, since it uses the macro successfully, but I'm not sure how to view the source (I usually pretend to suggest an edit and then cancel it, but that doesn't work here).

PRE: I assume that the answer is that "no, it doesn't", since the invocation in the parent post doesn't work.


POST: Looks like I was wrong! There's no \require{cancel} here, but it works. So why doesn't it work in the parent post?

  • 1
    $\begingroup$ The order of how things are rendered may matter - Asaf's answer is displayed above yours because it is the accepted answer, which means the MathJax parser encounters \require{cancel} before the \cancel in your post. On the other hand, the parent post doesn't have a \require{cancel}. There have been similar issues in the past, but I thought they were solved by this adjustment in 2019. $\endgroup$
    – KReiser
    Mar 30, 2021 at 20:59

You must log in to answer this question.

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