Search code examples
mathjax

Mathjax is incorrectly rendered


I noticed that MathJax is incorrectly rendered. Here https://www.emathhelp.net/calculators/calculus-2/integral-calculator/?f=xsinx&var=&steps=on under "the integral of the cosine is ..." only integral of cosine on left-hand-side and sine on the right-hand side should be red, not equal sign and -xcos(x).

However, when I click "show math as tex commands", I get - x \cos{\left(x \right)} + \color{red}{\int{\cos{\left(x \right)} d x}} = - x \cos{\left(x \right)} + \color{red}{\sin{\left(x \right)}} and this is the string without any errors.

What is causing incorrect color rendering?


Solution

  • The site you link to uses the color extension for MathJax, which redefines the \color macro to be compatible with the LaTeX version. In LaTeX, \color is a switch that changes the color from there on, rather than MathJax's version where \color takes an argument that is what to be colored. So something like \color{red}{x} + y usually would produce a red "x" and a black "+ y", but with the color extension would produce red "x + y". This is why you are seeing completely red expressions in the website you linked to.