# Use NotebookWrite with Graphics?

I am trying to use NotebookWrite to paste a plot into another notebook. The code looks something like:

ptemp = Show[Plot[x^2,{x,-2,2}],Plot[x^3,{x,-2,2}]]; nb = CreateDocument[]; NotebookWrite[nb,ptemp];

But when I run the code I get an error message: An unknown box name (Graphics) was sent as the BoxForm for the expression.

Is there any way to use NotebookWrite to insert a graphic? Does there exist any sort of wrapper for Graphics that would make it NotebookWrite-able?

-

NotebookWrite[nb, ToBoxes[ptemp]]
With NotebookWrite[], you must use boxes ("low-level-box-language"), not Graphics (which belongs to normal Mathematica language, like nearly everything). The "box-language" is what you see when you type ctrl-shift-E on a cell. ToBoxes transforms pTemp to a box. NotebookWrite[] inserts automatically the data (the box) in a Cell[] (see doc) and inserts the Cell[..data..] in the notebook.