$PrePrint

$PrePrint
is a global variable whose value, if set, is applied to every expression before it is printed.

DetailsDetails

  • $PrePrint is applied after Out[n] is assigned, but before the output result is printed.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

By default, $PrePrint is not defined, meaning output is shown as it comes from evaluation:

In[1]:=
Click for copyable input
Out[1]=

Show exact quantities by their numerical value:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

The function is designed to preserve arbitrary precision numbers if they are in the output:

In[4]:=
Click for copyable input
Out[4]=

Restore $PrePrint to the default:

In[5]:=
Click for copyable input

Note that changing $PrePrint did not change the values saved in Out:

In[6]:=
Click for copyable input
Out[6]=
New in 1
New to Mathematica? Find your learning path »
Have a question? Ask support »