# Mathjax bug while editing an answer.

On this answer \deriv appears as red text when I am viewing the answer normally.

When I click on edit the error disappears on the edit preview window.

Is this just me ? Is this a known bug ?

It is not really a bug but a strange quirk with \newcommand.

The command \deriv is not defined in the answer post you mention, and thus it does not work; it would need to be defined before it is used. But it is defined in the other answer post.

Without additional measures it is not confined to this answer post, but is applied to everything that comes "after" it. Apparently the preview in some technical sense comes after it, but in the view you use the answer post comes before.

If you switch to sorting the questions by "oldest" so that the other answer is displayed first on the page, then it works there, too.

The easiest fix is to include the newcommand from the other answer also in this one. (I do not do it right away so that you can check what I said.)

To avoid such interactions it is possible to confine newcommand and alike to the post. The way to do this is explained in this answer

If this would be done for the other answer, the error should also be visible in preview.

• Should I just put newcommand in the question so it is on the top ? – A---B Oct 31 '17 at 20:43
• No, I think it is clearer it is in both answers where it is used, as it is now after your edit. – quid Oct 31 '17 at 20:45