How do I get Mathematica to avoid displaying nested fractions in outputs, and instead automatically display them as parenthesized, factored-out terms?
For example, I would like
(A/(B + C) + D)/F
to be displayed as $\frac{1}{F} \left(\frac{A}{B+C}+D\right)$ instead of $\frac{\left(\frac{A}{B+C}+D\right)}{F}$.
If possible, I would like to do this in a somewhat automated manner, without having to manually Inactivate multiplications, for instance.
It would be great if the solution could work for "higher-order" nested fractions too. For instance:
((A/(B + C) + D)/F + G)/H
could be displayed as $\frac{1}{H}\left(\frac{1}{F}\left(\frac{A}{B+C}+D\right)+G\right)$
Consider an actual example of expression that I have in my code:
L^2 + (-4 + (6 L)/J + (L^2 (7 - 2 \[Nu]))/J^2 + (L^4 (-9 + \[Nu]))/ J^4 + \[Nu])/c^2 + ((L (77/2 - 11 \[Nu]))/J^3 + (4 + \[Nu]/4)/ L^2 + (3 L^3 (-9 + \[Nu]))/J^5 + (-(39/2) + 6 \[Nu])/(J L) + ( L^4 (-6920 + 2580 \[Nu] - 179 \[Nu]^2))/(32 J^6) + ( 168 + 12 \[Nu] + \[Nu]^2)/(32 J^2) + ( 7 L^6 (360 - 96 \[Nu] + 7 \[Nu]^2))/(16 J^8) + ( L^2 (294 - 149 \[Nu] + 10 \[Nu]^2))/(4 J^4))/c^4
I would like to ideally have an output similar to:
$ L^2 + \frac{1}{c^2}\left(\frac{L^4 (\nu -9)}{J^4}+\frac{L^2 (7-2 \nu )}{J^2}+\frac{6 L}{J}+\nu -4\right) +\frac{1}{c^4}\left(\frac{7 L^6 \left(7 \nu ^2-96 \nu +360\right)}{16 J^8}+\frac{L^4 \left(-179 \nu ^2+2580 \nu -6920\right)}{32 J^6}+\frac{3 L^3 (\nu -9)}{J^5}+\frac{L^2 \left(10 \nu ^2-149 \nu +294\right)}{4 J^4}+\frac{L \left(77-22\nu \right)}{2 J^3}+\frac{\nu ^2+12 \nu +168}{32 J^2}+\frac{12 \nu - 39}{2 J L}+\frac{\nu + 16}{4 L^2} \right) $
(a/(b + c) + d)/f /. (1/x_)*y_ :> HoldForm[Defer[(1/x)] y]
. $\endgroup$