I'd like to format the output of certain operators with Infix
-style formatting to have lower precedence than Times
.
Let's say I define foo
to format as CenterDot
:
Format[x_foo]:=CenterDot@@foo
The following prints with no parentheses (as expected) :
a * foo[x,y]
(* a x \[CenterDot] y *)
This is the sort of output I want :
a*PrecedenceForm[ foo[x,y], 395 ]
(* a (x \[CenterDot] y) *)
However, I'd like to abstract this away a bit more. I'd like to instead do something like
Format[x_foo]:=PrecedenceForm[CenterDot @@ x, 395]
so that this is handled entirely at the output level. However, the PrecedenceForm
doesn't seem to do anything:
a*foo[x,y]
(* a x \[CenterDot] y *)
Of course, I'm just as interested in why this doesn't work as I am in solving the problem of inserting parentheses.