If you evaluate a DocumentNotebook[]
expression in the front-end, it nicely displays inline, inside of an output cell in the current notebook:
For my purposes, TextCell
and ExpressionCell
expressions are insufficiently flexible. So (as in the question Combination of CellPrint and PrintTemporary, or DisplayForm for Cells), I'm programmatically generating some formatted output that generates raw Cell[]
box expressions. For instance, the output might be
cell = Cell[TextData[{"Function ",
Cell[BoxData[FormBox[RowBox[{"f","(","x",")"}],
TraditionalForm]], FormatType->"TraditionalForm"]}],
"Subsection"];
(where $f(x)$ will actually be some complicated expression).
Unfortunately, DocumentNotebook[]
seems to require TextCell
/ExpressionCell
and doesn't work when given Cell[]
s:
So I tried using Notebook[]
instead, which does work with Cell[]
s. However, evaluating a Notebook
expression doesn't display in the front-end:
It displays correctly when I run NotebookPut@Notebook@{cell}
, but in a new window. How can I get it to display inline in the current notebook, like how DocumentNotebook
displays? I tried wrapping it in CellPrint
and in DisplayForm
, but those don't work for Notebook[]
s.
Relatedly, what's the difference between DocumentNotebook
(and friends) and Notebook
? Both appear to be intended to represent a notebook as an expression, but as I discovered they behave slightly differently.
Comments
Post a Comment