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?

2 Answers 2


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}

A less fragile variant of the other answer, which allows \cancel to continue to use the old color:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.