For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > September 2007 > Error using Notebook?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Error using Notebook?
John

2007-09-22, 4:27 am

In Wellin, page 311, 3-rd edition, the instructions:


Notebook[{
cell["Demo notebook","Section"],
cell["This is a text cell","Text"],
cell["1+2+3","Input"]
}]
]

printed the cell contents on Untitled-1, but nothing was printed, when
I tried it.

I am using Mathematica 6.

John


Jean-Marc Gulliet

2007-09-23, 4:38 am

John wrote:

> In Wellin, page 311, 3-rd edition, the instructions:
>
>
> Notebook[{
> cell["Demo notebook","Section"],

--------^^^^
Mathematica names are *always* written with a capital: so Cell rather
than cell

> cell["This is a text cell","Text"],
> cell["1+2+3","Input"]
> }]
> ]

--^
Extraneous square bracket

>
> printed the cell contents on Untitled-1, but nothing was printed, when
> I tried it.
>
> I am using Mathematica 6.


When written correctly, the expression works fine with version 6. Note
that, as indicated in the book (paragraph just above the following
code), the notebook expression must be save in a text file. Then, when
one opens the file within Mathematica, the contents will be interpreted
as a notebook and the cells will be displayed as expected.

---------- The code below should be saved in a text file, say mynote.nb
Notebook[{
Cell["Demo notebook","Section"],
Cell["This is a text cell","Text"],
Cell["1+2+3","Input"]
}]
---------- end of the file mynote.nb

Also, you can copy and past the above expression within a already opened
notebook. Mathematica will recognized that this expression is indeed a
notebook and a dialog box will be displayed asking if the user wants to
interpret it as a notebook.

Regards,
--
Jean-Marc

Norbert Marxer

2007-09-26, 8:15 am

On 22 Sep., 09:29, John <j...@lehigh.edu> wrote:
> In Wellin, page 311, 3-rd edition, the instructions:
>
> Notebook[{
> cell["Demo notebook","Section"],
> cell["This is a text cell","Text"],
> cell["1+2+3","Input"]
> }]
> ]
>
> printed the cell contents on Untitled-1, but nothing was printed, when
> I tried it.
>
> I am using Mathematica 6.
>
> John


Hello

If you correct your syntax errors (Cell instead of cell, and drop the
last square bracket ]) then applying CreateDocument will open a new
notebook. e.g.

Notebook[{
Cell["Demo notebook","Section"],
Cell["This is a text cell","Text"],
Cell["1+2+3","Input"]
}]//CreateDocument

Best Regards
Norbert Marxer



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com