TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 17 down vote accepted

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}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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