In a nutshell I'm trying to mimic Mathematica's Message window functionality in that I'm trying to Print to a notebook other than the invoking notebook. That is, as my process is running from Notebook1, process information is output to Notebook2 (which is currently displayed as well).
I've explored and am currently using a NotebookWrite implementation but display of matrices or algebraic expressions is problematic given the restrictions on the Cell data expected in that command. My current implementation is using,
NotebookWrite[outputNotebook, Cell[TextCell[outMsg], "Print"], After];
However, this is limited to text messages so trying to output a MatrixForm[...] of information appears as text of the command rather than in actual matrix format.
I've considered redirecting the $Output and using Print, but it seems that approach expects "stream-level" writing to a file and doesn't accommodate an open notebook as the destination.
Ultimately I would like to use a simple wrapper on Print and make use of its robust support of multiple, varied-type, arguments to print, such as,
myPrint["Here's the information:", {x^2, y^2}, MatrixForm[{{a,b},{c,d}}] ];
and have it show as
$$\text{Here's the information:} \{x^2, y^2\}, \begin{bmatrix}a&b\\ c&d\end{bmatrix}$$
Any suggestions, or directions on where to investigate would be greatly appreciated.
Cell + BoxData + ToBoxes + Rowlike in 32890, does it fit your needs? Or better, take a look at topics linked to that one in comments and tell us which fits the best. – Kuba Mar 09 '17 at 16:35CellPrint, which will them produce a properCellout of them? (Of course additionally they display as they would when converted toCell, but that's something else.) – Szabolcs Mar 09 '17 at 16:42CellPrinthas this property:CreateDocument@ExpressionCell[Defer[1 + 1], "Input"]– Kuba Mar 09 '17 at 16:45