formatting
- To: mathgroup at smc.vnet.net
- Subject: [mg25869] formatting
- From: "Tom De Vries" <tdevries at shop.westworld.ca>
- Date: Sat, 4 Nov 2000 02:04:14 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello! I am trying to write some input lines to a notebook, and I am having some formatting troubles. I wonder if anyone can suggest how to deal with this question? fred = SelectedNotebook[]; NotebookWrite[fred, Cell[BoxData[ RowBox[{RowBox[{"f", "[", "x_", "]"}], ":=", RowBox[{2, SuperscriptBox["x", "2"]}]}]] , "Input", GeneratedCell -> False]]; The above lines do what I would like them to.... however.... x1 = 3; xa = 3 - 0.01; Now, the following input line does what I want, but because of the decimal in there, it doesn't look like what I want it to.... NotebookWrite[fred, Cell[BoxData[ FractionBox[ RowBox[{RowBox[{"f", "[", xa, "]"}], "-", RowBox[{"f", "[", x1, "]"}]}], RowBox[{xa, "-", x1}]]], "Input", GeneratedCell -> False]]; I am looking to simply see f[2.99] instead of that long decimal there. I also found that with some numbers I get what I want. So this has something to do with the internal representation of the number. How can I create that input line and have Mathematica just display the decimal with 2 numbers after the decimal point? I got a very nice program for doing this in Text cells (from Bob Hanlon) but it doesn't produce the desired effect in an input cell. Thanks for any help you might provide! Tom De Vries