Re: Inserting the value of a current variable (symbol) in a text cell?
- To: mathgroup at smc.vnet.net
- Subject: [mg9426] Re: [mg9314] Inserting the value of a current variable (symbol) in a text cell?
- From: Tom <toad at planet.eon.net>
- Date: Wed, 5 Nov 1997 01:56:41 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Hello Mathematica users, This is to respond to the question about inserting the value of x in a text cell. (I am not sure of the reference number) Using Mathematica 3.0 here is a solution. x:=Random[Integer, {-3,3}] (*let x take on some random value when called*) CellPrint[Cell[TextData[{ "This is a sample cell where the value of x can be displayed. The value \ of x is ", x, " and that's all folks."}], "Text"]] The above line will create a cell with the text as indicated. The commas separate the various parts of the text which is quoted and the display of the variable which can be done simply by not "quoting" the x. One thing that I have found VERY useful to handle these kinds of formatting questions is to first type what you want into a text cell, then use the Show Expression command to see what it "really" looks like and then create your CellPrint command based on that. Related to this, there was a posting a little while back about spell checking Mathematica files. Because simple text on the screen is represented internally by cell structures, (there's a LOT more text that what is seen on the screen) I am not sure if spell checking is possible. I too would love to have that functionality but for now I use my word processor for large bits of text, check them there, and paste them into a text cell in Mathematica. Hope this is usual information, Sincerely, Tom De Vries