The ultimate substance of all matter is the atom, likewise,
the ultimate substance of mathematica cell is the cell expression,
and it can be obtained easily.
After copying the cell expression, and paste it then we see following popup :
Here, if I click yes, a cell with the cell expression(=copied a minute ago) is created.
(If click no, a cell of plain texts(=copied a minute ago) is created)
In fact the plain text of the cell expression is
Cell[BoxData[blahblah], ...]
And executing the following code is almost equivalent to pasting the copied cell exression and clicking yes.
ToExpression[BoxData[blahblah]]
What I want to say is from now on. It is almost equivalent, but not 100% equivalent.
For example, I experienced that
the copied cell expression for a certain cell with a certain image was
Cell[BoxData[GraphicsBox[blahblah, ... , BaseStyle -> "ImageGraphics" , ...]],...]
For this cell(=a certain cell with a certain image), let's first try copy cell expression and paste method.
Then I get 100% the same cell. In other words, the cell is duplicated exactly.
Now let's try ToExpression[BoxData[.. method. Execute
ToExpression[BoxData[GraphicsBox[blahblah, ... , BaseStyle -> "ImageGraphics" , ...]]]
then the output cell created isn't the same as the original cell. To be specific, one of the option part
BaseStyle -> "ImageGraphics"
is changed to
DefaultBasicStyle -> "ImageGraphics"
The change isn't small.
Because if that part is changed, the image size (the size we see by eyes) doesn't vary according to notebook magnification.
(If you would like to know more about this issue please refer to the following link :
Creating a size changing image in output cell)
ToExpression generally works well but not in 100% manner.
Copy cell expression and paste method is 100% method but difficult to implement in code and cumbersome even if implemented.
Can we create a function, that works 100% exactly like copy cell expression and paste method?
WithThisCellExpression[...]
NextCellShouldBeExactly[...]
UltimateOutputControl[...]
DirectCellWrite[...]
It will be a revolution at least for me.
ClipboardNotebook
andNotebookWrite
may be helpful. $\endgroup$var1
, with some codes. In that respect, I think the role ofClipboardNotebook
is almost over at that stage. $\endgroup$NotebookWrite
can do it but after seeing examples the tutorial ofNotebookWrite
,NotebookWrite
doesn't seem to have ability to create a cell with given cell expression. $\endgroup$