在 mathjax 中使用 CancelColor

use CancelColor in mathjax

我想在 mathjax 中使用 \cancel{·}。用不同颜色的交叉线解释 here

我用

\[
enter code here
\require{xcolor}
\require{cancel}
\renewcommand\CancelColor{\color{red}}

\cancel{x^2}
\]

但是没有用。有什么想法吗?

为了将来的参考,tex Stack Exchange 中给出了一个很好的答案 here