Re: cellform to console form
- To: mathgroup at smc.vnet.net
- Subject: [mg73463] Re: cellform to console form
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 18 Feb 2007 06:10:52 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <er6kvm$put$1@smc.vnet.net>
Peter Jay Salzman wrote:
> I like working with the front end, but sometimes I want to cut and paste
> snippets to send to people. When I do, I get all the ... "stuff" that helps
> format the front end's cells.
>
> Is there a way of converting selected front end expressions into
> console/email readable text?
Hi Pete,
By default, Mathematica are in StandardForm. (They contain Mathematica
expressions with typesetting information.)
It is customary to send Mathematica code by email in InputForm. (An
InputForm is a fully executable Mathematica expression without the
typesetting information for the cell/notebook.)
If what you want is really the look and feel of a console application
from the front end, you can use OutputForm for the output cells and also
for the input cell if you wish. (Note that in this case the expressions
are not executable if copied back into Mathematica.) Of course, a fixed
font is required to display properly.
Among many other possibilities, to convert cells from one form to
another, select the cells first, then go to menu Cell --> Convert to ...
/ Display as ...
Here is an example showing the same expression in StandardForm
(In/Out[1]), InputForm (In/Out[2]), and OutputForm (In/Out[3]).
In[1]:=
\!\(Expand[\((a + b)\)\^3]\)
Out[1]=
\!\(a\^3 + 3\ a\^2\ b + 3\ a\ b\^2 + b\^3\)
In[2]:=
Expand[(a + b)^3]
Out[2]=
a^3 + 3*a^2*b + 3*a*b^2 + b^3
In[3]:=
3
Expand[(a + b) ]
Out[3]=
3 2 2 3
a + 3 a b + 3 a b + b
Regards,
Jean-Marc