The subject line just about says it. If I have ab/b I want to indicate that the b's cancel. On a board I would simply strike them through. How to I do the same in LaTex? I've tagged this as stacking-symbols as I'm guessing that's like the trick but I can't figure out which symbol and how to stack it.

  • 4
    You can do it with the cancel package.
    – Bernard
    May 29, 2022 at 18:22
  • Shiny! Thanks @Bernard.
    – TonyK
    May 29, 2022 at 20:22
  • 4
    I’m voting to close this question because it was solved in the comments.
    – TobiBS
    May 30, 2022 at 19:26
  • 1
    @Bernard Please turn that into an answer.
    – Stephen
    May 30, 2022 at 19:47
  • 1
    @Stephen; You're right, it would be helpful also to others. 'Tis done.
    – Bernard
    May 30, 2022 at 20:43

2 Answers 2


Here's how to do it with cancel:

    \usepackage{cancel, amsmath}


        \[ \frac{a\cancel{b}}{\cancel{b}} = a \]%


enter image description here


For completeness, I will mention the \not command. It does not depend on any package, but the strike-through is not always very nice.

It is usually used for operators instead of symbols, so \not\sim, \not\cong, \not\equiv etc.

It can also be used for other symbols, such as \not\exists, but the results are usually unsatisfactory. In this specific case, \nexists from amsmath package is better.

For example, consider the following code

$$\not\sim\ \not\cong\ \not\equiv\ \not\exists$$
$${\displaystyle\frac{a\not b}{\not b}}\ 
{\textstyle \frac{a\not b}{\not b}}\ 
{\scriptstyle\frac{a\not b}{\not b}}$$

It produces the following output: Latex Not example output

You can see that the strike-through in the fractions makes the whitespace around the b ugly in the \displaystyle example, and in the other examples the strikethrough is not through the middle of the b.

For your specific case, the cancel package mentioned above is much better, but in other cases the \not command might help.

  • Thanks for the followup. I hadn't realized \not could be used with a variety of elements.
    – TonyK
    Jun 20, 2022 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .