Re: Remove quotes from Cell Expression
- To: mathgroup at smc.vnet.net
- Subject: [mg99555] Re: Remove quotes from Cell Expression
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Fri, 8 May 2009 00:12:33 -0400 (EDT)
- References: <gtrl2u$1ol$1@smc.vnet.net>
robert prince-wright wrote:
> Can someone show me how to write the list m1 to a notebook without the quotes showing?
>
> m1 = {{"a",b},{c,d}};
> nb = CreateDocument[];
> NotebookWrite[nb, Cell[ToBoxes@Grid[m1],"Text"]]
>
> The expression below gives the right result so there is something missing in my limited understanding of Cell expressions.
>
> Grid@m1
>
If you unformat the two cells (click in the cell and use the menu item
Cell>Show Expression), you will see that your first cell is of style
"Text", while the second is of style "Output" - that is why they look
different. One way to make a text cell with strings displayed without
quotes is like this:
m1 = {{"a", b}, {c, d}};
nb = CreateDocument[];
NotebookWrite[nb,
Cell[ToBoxes@Grid[m1], "Text", ShowStringCharacters -> False]]
Alternatively, you can specify "Output" style rather than "Text" style
for your cell.
Unformatting existing cells and copy/pasting the expression revealed, is
a great way to create new cell expressions in your code.
David Bailey
http://www.dbaileyconsultancy.co.uk