Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to NotebookWrite a Cell in StandardForm with a Grid to a new document. What I'd like to copy is

toCopy = TraditionalForm@Grid[{{a^2, b^2, c^2}, {d^2, e^2, f^2}}]

If I now use the following code

 , toCopy]

I get a red rectangle in the new Notebookbook. I've tried to change all letters a to f to "a" ... "f", but nothing changed.

I am somewhat puzzled... What I missing here? Thanks for all help, as always!

Edit: With the answer of Alexey, it works good to copy the Grid to the new Notebook. But the TraditionalForm is lost: I get InputForm. Even using

  ToBoxes[toCopy, TraditionalForm]]

doesn't seem to work. Any more help, as always, very much appreciated!

share|improve this question

You should pass boxes as the second argument to NotebookWrite:

toCopy = Grid[{{a^2, b^2}, {c^2, d^2}}];
NotebookWrite[CreateDocument[], ToBoxes@toCopy]

Answering your second question, it is sufficient to wrap the expression by TraditionalForm to get it in TraditionalForm:

NotebookWrite[CreateDocument[], ToBoxes@TraditionalForm@toCopy]

But it still gives you an "Input" Cell. If you wish to generate an "Output" Cell, you should specify it explicitly:

 Cell[BoxData@ToBoxes@TraditionalForm@toCopy, "Output"]]

P.S. Also, see relevant discussion in this thread: "Programmatically writing to a notebook in TraditionalForm."

share|improve this answer
Thanks, this works good for the copying, but changes back to InputForm (I think), and not TraditionalForm. I appreciate any help for this problem! – Gabriel Nov 9 '13 at 10:22
@Gabriel Please see updated answer. – Alexey Popkov Nov 9 '13 at 15:57
Thank you for the update! – Gabriel Nov 10 '13 at 10:34

I found the solution analysing the output of Mathematica with "Show Expression".
To display the contents of a Cell in TraditionalForm, one has to use a
FormBox[ ..., TraditionalForm] around the boxes given to Cell (for example, using ToBoxes,
as follows:

    Cell[ FormBox[ ToBoxes @ Grid[{{a^2, b^2}, {c^2, d^2}}], TraditionalForm] ]

Thanks for informing if I misunderstood somewhere along the lines... Hope this helps to other Mathematica users.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.