Re: Infix doesn't worj with precedence and grouping

*To*: mathgroup at smc.vnet.net*Subject*: [mg113722] Re: Infix doesn't worj with precedence and grouping*From*: Andrea <btlgs2000 at gmail.com>*Date*: Tue, 9 Nov 2010 03:52:33 -0500 (EST)*References*: <ib0l9q$gio$1@smc.vnet.net>

On Nov 5, 11:12 am, Dims <dim... at hotmail.com> wrote: > It is told in help, that > > Infix[expr,h,precedence,grouping] can be used to specify how the > output form should be parenthesized. > > but actually it doesn't work: > > Format[EClass[x___]] := Infix[{x}, "=", 290, None] > In[40]:= EClass[a, b, c] > Out[40]= Infix[{a, b, c}, "=", 290, None] > > while > > In[65]:= Format[EClass[x___]] := Infix[{x}, "="] > In[66]:= EClass[a, b, c] > Out[66]= Infix[{a, b, c}, "="] > > works. > > So how to specify precedence for infix format? > > Thanks. It seems that the frontend only display the four argument form correctly only in OutputForm. Try >Infix[{x,y,z}, "=", 290, None] // OutputForm and you'll get >x=y=z I think you can solve this problem adding the following lines to your init file Unprotect[Infix]; Format[Infix[a_, b_, c_, d_], StandardForm] := Format[Infix[a, b, c, d], OutputForm]; Protect[Infix];