This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Input and Output / Formatting Functions  /
PrecedenceForm

  • PrecedenceForm[ expr , prec ] prints with expr parenthesized as it would be if it contained an operator with precedence prec.
  • prec must be an integer. See notes for Infix.
  • Example: a + PrecedenceForm[b c, 10].
  • PrecedenceForm acts as a "wrapper", which affects printing, but not evaluation.
  • See the Mathematica book: Section 2.8.16.

    Further Examples

    Here is an expression with a new infix operator.

    In[1]:=

    Out[1]=

    Parentheses are added around the expression depending on the size of the second argument of PrecedenceForm.

    In[2]:=

    Out[2]=

    In[3]:=

    Out[3]=

    In[4]:=