Skip to main content

I highly doubt something that answers your question is useful in any way, since your plan is to strip output of syntactically relevant information, but here we go:

Mathematica provides a few commands that are applied to input/output automatically:

$Post$Post

[$Post][2]$Post is automatically applied to all expressions before their output is printed. This alters the data, e.g. setting $Post = N will generate numerical data only.

{1 + 1, 1 + 2} (* Print lists in column form *) $Post = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* You can't add 1 to a column :-( *) % + 1 (* Reset the variable to default *) $Post =. {1 + 1, 1 + 2} 

Output

$PrePrint$PrePrint

[$PrePrint][5]$PrePrint is similar to $Post, only that it does not affect output but only the printed version, i.e. the visualization. Setting this to N will preserve the normal Mathematica workflow in the back end, only the display is different.

{1 + 1, 1 + 2} (* Print lists in column form *) $PrePrint = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* Only printing is affected, you can still do normal arithmetic with the output *) % + 1 (* Reset the variable to default *) $PrePrint =. {1 + 1, 1 + 2} 

Output

$Pre$Pre

[$Pre][8]$Pre is applied after the input has been put in. Make sure make sure to include a Hold somewhere, otherwise it's pretty much the same as $Post (see remarks in the documentation).

I highly doubt something that answers your question is useful in any way, since your plan is to strip output of syntactically relevant information, but here we go:

Mathematica provides a few commands that are applied to input/output automatically:

$Post

[$Post][2] is automatically applied to all expressions before their output is printed. This alters the data, e.g. setting $Post = N will generate numerical data only.

{1 + 1, 1 + 2} (* Print lists in column form *) $Post = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* You can't add 1 to a column :-( *) % + 1 (* Reset the variable to default *) $Post =. {1 + 1, 1 + 2} 

Output

$PrePrint

[$PrePrint][5] is similar to $Post, only that it does not affect output but only the printed version, i.e. the visualization. Setting this to N will preserve the normal Mathematica workflow in the back end, only the display is different.

{1 + 1, 1 + 2} (* Print lists in column form *) $PrePrint = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* Only printing is affected, you can still do normal arithmetic with the output *) % + 1 (* Reset the variable to default *) $PrePrint =. {1 + 1, 1 + 2} 

Output

$Pre

[$Pre][8] is applied after the input has been put in. Make sure make sure to include a Hold somewhere, otherwise it's pretty much the same as $Post (see remarks in the documentation).

I highly doubt something that answers your question is useful in any way, since your plan is to strip output of syntactically relevant information, but here we go:

Mathematica provides a few commands that are applied to input/output automatically:

$Post

$Post is automatically applied to all expressions before their output is printed. This alters the data, e.g. setting $Post = N will generate numerical data only.

{1 + 1, 1 + 2} (* Print lists in column form *) $Post = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* You can't add 1 to a column :-( *) % + 1 (* Reset the variable to default *) $Post =. {1 + 1, 1 + 2} 

Output

$PrePrint

$PrePrint is similar to $Post, only that it does not affect output but only the printed version, i.e. the visualization. Setting this to N will preserve the normal Mathematica workflow in the back end, only the display is different.

{1 + 1, 1 + 2} (* Print lists in column form *) $PrePrint = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* Only printing is affected, you can still do normal arithmetic with the output *) % + 1 (* Reset the variable to default *) $PrePrint =. {1 + 1, 1 + 2} 

Output

$Pre

$Pre is applied after the input has been put in. Make sure make sure to include a Hold somewhere, otherwise it's pretty much the same as $Post (see remarks in the documentation).

Source Link
David
  • 15.1k
  • 6
  • 53
  • 82

I highly doubt something that answers your question is useful in any way, since your plan is to strip output of syntactically relevant information, but here we go:

Mathematica provides a few commands that are applied to input/output automatically:

$Post

[$Post][2] is automatically applied to all expressions before their output is printed. This alters the data, e.g. setting $Post = N will generate numerical data only.

{1 + 1, 1 + 2} (* Print lists in column form *) $Post = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* You can't add 1 to a column :-( *) % + 1 (* Reset the variable to default *) $Post =. {1 + 1, 1 + 2} 

Output

$PrePrint

[$PrePrint][5] is similar to $Post, only that it does not affect output but only the printed version, i.e. the visualization. Setting this to N will preserve the normal Mathematica workflow in the back end, only the display is different.

{1 + 1, 1 + 2} (* Print lists in column form *) $PrePrint = If[Head[#] === List, Column[#]] &; {1 + 1, 1 + 2} (* Only printing is affected, you can still do normal arithmetic with the output *) % + 1 (* Reset the variable to default *) $PrePrint =. {1 + 1, 1 + 2} 

Output

$Pre

[$Pre][8] is applied after the input has been put in. Make sure make sure to include a Hold somewhere, otherwise it's pretty much the same as $Post (see remarks in the documentation).