is a global variable whose value, if set, is applied to expressions before they are included in the text of messages.
$MessagePrePrint
is a global variable whose value, if set, is applied to expressions before they are included in the text of messages.
Details
- The default value of $MessagePrePrint is Automatic.
- $MessagePrePrint is applied after each expression is wrapped with HoldForm.
Examples
open all close allBasic Examples (1)
Have expressions in messages print out in TraditionalForm:
$MessagePrePrint = TraditionalForm;NDSolve[{x''[t] + x[t, s] == 0, x[0] == x'[0] == 1}, x, {t, 0, 1}]Restore the default. Now the expressions are shown in StandardForm:
$MessagePrePrint = Automatic;
NDSolve[{x''[t] + x[t, s] == 0, x[0] == x'[0] == 1}, x, {t, 0, 1}]Scope (2)
Locally define $MessagePrePrint so that expressions sent to messages are shown in a circle:
Block[{$MessagePrePrint = Graphics[{Text[ToString[#], {0, 0}], {Red, Circle[]}}, ImageSize -> 30]&}, Sin[1, 2]]The local definition does not affect messages outside the Block:
Sin[1, 2]Make a list of all expressions sent to messages during a computation:
Block[{$MessagePrePrint = Sow}, Reap[Sin[1, 2];LinearSolve[N[{{1, 2}, {1 + $MachineEpsilon, 2}}, {3, 4}]]]]Tech Notes
Related Guides
History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), $MessagePrePrint, Wolfram Language function, https://reference.wolfram.com/language/ref/$MessagePrePrint.html.
CMS
Wolfram Language. 1991. "$MessagePrePrint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$MessagePrePrint.html.
APA
Wolfram Language. (1991). $MessagePrePrint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$MessagePrePrint.html
BibTeX
@misc{reference.wolfram_2026_$messagepreprint, author="Wolfram Research", title="{$MessagePrePrint}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/$MessagePrePrint.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$messagepreprint, organization={Wolfram Research}, title={$MessagePrePrint}, year={1991}, url={https://reference.wolfram.com/language/ref/$MessagePrePrint.html}, note=[Accessed: 15-June-2026]}