Here is a variation of the idea of ββsacra, which allows you to add and multiply ...
Format[setDenominator[x_, d_]] := DisplayForm@FractionBox [x*d, d] setDenominator /: Plus[left___, setDenominator[x1_, d1_], right___] := left + x1 + right; setDenominator /: Times[left___, setDenominator[x1_, d1_], right___] :=left*x1*right;
Attempt:
a = setDenominator[3/5, 10]; Print[a, " + ", 2/3, " = " , a + 2/3] Print[a, " + ", 2/3, " = " , setDenominator[a + 2/3, 30]] Print[a, " Γ ", 2/3, " = " , a * 2/3] Print[a, " Γ ", 2/3, " = " , setDenominator[a * 2/3, 30]] Print[a, " Γ· ", 2/3, " = " , a /( 2/3)]
source share