Re: Preventing NotebookWrite From Wrapping
- To: mathgroup at smc.vnet.net
- Subject: [mg20513] Re: [mg20431] Preventing NotebookWrite From Wrapping
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 27 Oct 1999 02:05:07 -0400
- Sender: owner-wri-mathgroup at wolfram.com
It would be nice if the Mathematica Book had more examples of writing out cells. One
help is to type a typical cell you wish to write and then use Show Expression to see
the underlying form.
This will more or less do what you want:
NotebookWrite[nb, Cell["Min Residual = " <> ToString[minresidual], "Output"]]
which writes:
Min Residual = 0.0522
If you want to write an expression, and not just a string, like this:
x == 0.0522
you can use
NotebookWrite[nb,
Cell[BoxData[RowBox[{"x", "==", ToString[minresidual]}]], "Output"]]
You can obtain the form of the Cell expression by typing a sample cell and looking at
the underlying expression. Or you can do it directly using this form of statement:
NotebookWrite[nb, Cell[BoxData[ToBoxes[x == minresidual]], "Output"]]
and once we see that, we can write your original statement with:
NotebookWrite[nb,
Cell[BoxData[ToBoxes[SequenceForm["Min Residual = ", minresidual]]],
"Output"]]
I think that your basic problem was not using the Cell[BoxData[...]] form.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
>In Mathematica 3.0 how would I write text and the value of a parameter
>to a notebook such that both end up on the same line ?
>
>What I would like written to the notebook is for example
>
>Min Residual = .0522
>
>I tried
>NotebookWrite[nb,{"Min Residual=",minresidual}]
>
>where nb=NotebookCreate[] and minresidual is the desired value.
>
>The problem is that minresidual wraps to the next line, like so
>
>Min Residual=
>.0522
>
>Is there a way to prevent this wrapping ?
>
>Thanks
>
>Steve
>