For example, suppose I had an equation
x = 2 + 1 – 2 – 1 (obviously toy example)
I want the +2 to cancel out with the -2, +1 to cancel out with the -1
So in Latex I would want something like
Is there a simple way to implement multi-colored strike through or cancel in Latex?
A similar question is found here but it is for global coloring
crossing out using different colour
Best Answer
One possibility is to use
cancel
. (EDIT: Replaced\textcolor
by color, big thanks to Werner!)Note, however, that an ambient color will be without effect, i.e. instead of
{\color{green}\Cancel[blue]{2}+\Cancel[red]{1}}
you'd need to do\Cancel[blue]{\color{green} 2}+\Cancel[red]{\color{green} 1}
unfortunately. I guess that there will be better ways and am looking forward to learn new tricks.EDIT: Just for fun: a TikZ version. The option
X
will do an\xcancel
sort of cross out.