({{, (RefLink[Format, paclet:ref/Format])[expr]
prints as the formatted form of expr. Assigning values to (RefLink[Format, paclet:ref/Format])[expr] defines print forms for expressions. }, {, (RefLink[Format, paclet:ref/Format])[expr,form]
gives a format for the specified form of output. }})

OpenersNotesSection(Spacer1)Details

Standard forms for formatted output are:

You can add your own forms for formatted output.

(RefLink[Format, paclet:ref/Format])[s]:=rhs defines a symbol s to print like rhs.

(RefLink[Format, paclet:ref/Format])[f[…]]:=rhs defines a function f to print like rhs.

If you specify a new output format for an expression by giving a definition for (RefLink[Format, paclet:ref/Format]), there is no guarantee that the Wolfram Language will be able to interpret this output format if it is used as input.

Definitions given for (RefLink[Format, paclet:ref/Format]) are used before those given for (RefLink[MakeBoxes, paclet:ref/MakeBoxes]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (5)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

See an expression formatted in (RefLink[TraditionalForm, paclet:ref/TraditionalForm]):

Format[Sin[x],TraditionalForm]

OpenersExampleSection1(Spacer1)Scope  (3)

Format kappa as the Greek letter:

Format[kappa]:=κ

kappa

Format a function f differently if it has more than two arguments:

Format[f[x_,y_,z__]]:=f[x,…]

f[a,b]

f[a,b,c]

Define formatting for a specific form:

Format[bin[x_,y_],TraditionalForm]:=MatrixForm[{{x},{y}}]

bin[a,b]//TraditionalForm

(RefLink[StandardForm, paclet:ref/StandardForm]) output is unaffected:

bin[a,b]

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[MakeBoxes, paclet:ref/MakeBoxes]) and (RefLink[ToBoxes, paclet:ref/ToBoxes]) use formatting rules added via (RefLink[Format, paclet:ref/Format]):

MakeBoxes[bin[x,y],StandardForm]

ToBoxes[bin[x,y],StandardForm]

Add formatting for bin:

Format[bin[x_,y_]]:=MatrixForm[{{x},{y}}]

MakeBoxes[bin[i,j],StandardForm]

ToBoxes[bin[x,y],StandardForm]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ToString, paclet:ref/ToString])  ▪  (RefLink[ToBoxes, paclet:ref/ToBoxes])  ▪  (RefLink[MakeBoxes, paclet:ref/MakeBoxes])  ▪  (RefLink[MakeExpression, paclet:ref/MakeExpression])  ▪  (RefLink[FormatType, paclet:ref/FormatType])  ▪  (RefLink[Interpretation, paclet:ref/Interpretation])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Defining Output Formats, paclet:tutorial/DefiningOutputFormats])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Defining Custom Notation, paclet:guide/DefiningCustomNotation])}})}})