Format[expr]First, we set up a Format definition for f to display its arguments as if it were equivalent to an infix operator "~":
Format[f[x___]] := Infix[{x}, "~"]
Now, to see this format in use:
f[1, 2, 3]
f[1]
Raw objects cannot be formatted:
Format[3] = "three";
Format types must be symbols:
Format[r, a + b] = "r";
Formats must be attached to the head of an expression:
f /: Format[g[f]] = "my f";
Format can be used to specify the request format:
Format[Integrate[F[x], x], TeXForm]
Format evaluates its first element before applying the format:
Format[Integrate[Cos[x], x], TeXForm]
but the result keeps the structure:
% //FullForm
If the second parameter is omitted, Format is ignored:
Format[F[x]]
If the second argument is not one of $PrintForms, a message is shown, and the argument is discarded:
Format[F[x], NoFormat]
Mathics3 Format output can differ slightly from WMA in what we hope is a more useful way.
Use InputForm if you want to get a Format definition that can be used as Mathics3 input:
Format[{a -> Integrate[F[x], x]}, StandardForm] //InputForm
In WMA, you might not get something that can be used as input.
Similarly, use Fullform to get a valid FullForm equivalent expression:
Format[{a->Integrate[F[x], x]}, StandardForm] //FullForm