I need to show the path to simplify fractions, i.e., through their common divisors, so that show the first simplifications. For example: 18/6 I'd want to show some like this:


Taking 2 as a common divisor, I want that the 9 and the 3 appear above/below of 18 and 6 respectively. If I have more divisors they appear above/below of previous, for example, 50:


i.e., I want that 10 appears above of the cancelled 50, the 2 appear above of the cancelled 10 (if I divide for 5)

Is there some command or package that does that?

Thanks a lot!

  • 3
    Welcome to TEX.SE! There is a package named cancel which does what you want!
    – Imran
    Commented Jan 12, 2022 at 19:43
  • Please can you provide a minimal working example putting, if possible, an hand-drawing of that you want?
    – Sebastiano
    Commented Jan 13, 2022 at 17:19
  • Thanks Dan for your help. It's work fine. I modified a little the command using \cancel, because is more beauty, for example: \cancelmcd{24}{\cancelmcd{12}{\cancelmcd{6}{3}}} where \cancelmcd is a new command defined as: \newcommand{\cancelmcd}[2]{\substack{#2\\\text{\cancel{#1}}}} Sorry by my bad english
    – Darío
    Commented Jan 15, 2022 at 18:18

2 Answers 2


With a \substack and \sout from ulem you could do


enter image description here

You can keep adding lines to the stack, so you can have multiple divisors if you want.

  • I reviewed the modification above mentioned a bit because wasn't behaving quite as he expected, especially in the denominator. Searching in documents and manuals, I see the command overset and underset. I used like this: \overset{3}{\overset{\cancel{9}}{\cancel{27}}}, similarly for \underset. The new command was left this way: \newcommand[2]{\cancelnum}{\overset{#1}{\cancel{#2}}} \newcommand[2]{\cancelden}{\underset{#1}{\cancel{#2}}} when #1 is the new number and #2 is the canceled number.
    – Darío
    Commented Jan 26, 2022 at 3:18

As suggest @Imran in his comment - use of cancel package do this:


$\frac{\cancel{50}^{~5}}{\cancel{10}^{~1}} = 5$

enter image description here

You must log in to answer this question.

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