33

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..

Speravir
  • 19,491
Gurpreet
  • 423
  • 9
    Did you load the cancel package? – Joseph Wright Apr 09 '13 at 07:23
  • 7
    @Gurpreet As with every package: \usepackage{cancel} – Qrrbrbirlbel Apr 09 '13 at 20:31
  • 4
    to new users it is not obvious that \cancel comes from the cancel package. i found this question (and the answer) very helpful and am surprised it was closed as "too localized." please re-open. – abcd Sep 15 '17 at 15:08
  • 1
    @dbliss Why reopen? Reopening is for allowing more answers. There is an answer with the cancel package and with screenshot and explanation. No need to encourage writing further answers (again about making \cancel work with cancel package). Simply no need to open as no solution is prevented as the meaningful one has been given. Closed does not mean bad but answering closed. – Stefan Kottwitz Sep 17 '17 at 03:40
  • 1
    @StefanKottwitz in terms of practical effect, i don't have too much of a case to make. all i'd say is that new users might see this question and infer that questions like this are discouraged by the site, which seems to me wrong. and then technically, if the goal is just to prevent more answers, should the question be "protected" rather than "closed"? in the end, i don't care enough to have a meta debate about this minor issue. – abcd Sep 17 '17 at 11:12
  • @dbliss Yes, either way is good. It's just that for an actual change there should be a reason :-) Otherwise someone else could complain with similar reason as I said, why it was changed. – Stefan Kottwitz Sep 17 '17 at 15:01

1 Answers1

36

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}
  • 2
    \abovedisplayskip=0pt and \documentclass[preview,border=12pt,varwidth]{standalone} are used above just for my own purpose, you do NOT need them. One more \bcancel can be used not only for b but also for other charactes such as \bcancel{x} and \bcancel{y}. – kiss my armpit Apr 09 '13 at 07:35
  • @Joseph, I am done with this, I have installed Miktex and yes this package is loaded and successfully I have got the solution of my query.. – Gurpreet Apr 09 '13 at 19:35