[Tex/LaTex] cancel with different colors


I have equations with a lot of terms and I would like to be able to specify the reason of the cancelation of those terms using a color code (for example : red if the term is null, blue if it cancels out with another term, green if it can be considered as very small…).

How to define new commands to be able to cancel these terms with different colors using the cancel package?

Best Answer

The color of the line used by cancel can be changed with

\renewcommand\CancelColor{<color command>}

You could include this in a new cancel-command where an optional argument defines the color.

output of below code


\Ccancel{x+1} \qquad \Ccancel[blue]{x-1}