In[1]:=f[n]/9 // TeXForm
Out[1]//TeXForm=\frac{f(n)}{9}
but I need \frac{1}{9}f(n)
instead.
f[n] Defer[1/9] // TeXForm
\frac {1} {9} f (n)
Slightly more genearally,
ClearAll[deferRationalsAndPowers]
deferRationalsAndPowers = ReplaceAll[r : (_Rational | Power[_, -1]) :> Defer[r]];
expr = h[n]/9 + w[a]/b
deferRationalsAndPowers @ expr
TeXForm @ deferRationalsAndPowers @ expr
\frac{1}{b} w(a)+\frac{1}{9} h(n)
expr2 = 1/2 f[a]^6 + 3/4 f[b]^2 + 8/9 f[c]
deferRationalsAndPowers @ expr2
TeXForm @ deferRationalsAndPowers @ expr2
\frac{1}{2} f(a)^6+\frac{3}{4} f(b)^2+\frac{8}{9} f(c)
1/2 f[a]^6 + 3/4 f[b]^2 + 8/9 f[c]
, how to add 'defer' before each 'f[]' o(TωT)o
$\endgroup$
Commented
Feb 10, 2022 at 7:15