# Output short denominator as pre-factor

How can I make the output print like the input, with the short denominator written as a factor in front of the long expression?

I was messing with styles earlier today to do something else, and at one point it started printing like that, so I know it can be done, but then it reverted back.

• Defer[1/f] g. – Coolwater Apr 25 '16 at 6:24
• @Coolwater Could you elaborate more on your comment, please? – SU3 Apr 25 '16 at 6:26
• For your convenience, you could add your original code. In that way you will help community help you. It's easier copying code instead of writing down from scratch. – Tom Zinger Apr 25 '16 at 8:18
• – Michael E2 Apr 25 '16 at 11:07
• @MichaelE2 Only checked this Q out today - your deleted answer looks very useful! It could be added to \$POST to automate it. And maybe a condition on the ratio of LeafCounts could be added. – Jens Apr 28 '16 at 16:15

Not sure if all you want is formatted output. With Interpretation you get output you can copy.

Clear[fracform]
fracform[e_] /; Denominator[e] =!= 1 :=
Interpretation[
DisplayForm@ RowBox[{ToBoxes[1/Denominator[e]], " ", ToBoxes[Numerator[e]]}],
e];
fracform[e_] := e;

fracform[a/b]


• All I want is formatted output, so that when I print my Mathematica sheet to pdf and include it in my latex document it looks more readable. – SU3 Apr 25 '16 at 16:56
• So it works, then? (One could also replace Interpretation[..] by its first argument.) – Michael E2 Apr 25 '16 at 17:09