[Tex/LaTex] How to use \cancel command

cancel

I want to use \cancel command in TeXnicCenter but it is giving error while using that..

Basically I want to show cancellation of 2 with 2, using \frac.

Like:
\frac{2}{2} but I want to show it like: \(\frac{\cancel{2}}{\cancel{2}}\).

And I am unable to do it, can anybody please tell me how to do it..

Best Answer

enter image description here

\documentclass[preview,border=12pt,varwidth]{standalone}
\usepackage{cancel}
\begin{document}
\abovedisplayskip=0pt
\[
\frac{a\bcancel{b}}{\bcancel{b}}=a
\]
\end{document}
Related Question