Consider the following:
printMessage[cellexpr_]:=CellPrint@Cell[cellexpr,"Message",
CellLabel->"(slave Kernel)",ShowCellLabel->True,
CellFrameMargins->0,Background->LightBrown,
CellLabelAutoDelete->False];
printMessage[BoxData[RowBox[{RowBox[{"Sin", "::", "\"argx\""}], ": ",
"\"\\!\\(Sin\\) called with \\!\\(2\\) arguments; 1 argument is expected.\""}],
StandardForm]]
Sin[1,1];
-->
(slave Kernel) Sin::argx: Sin called with 2 arguments; 1 argument is expected.
During evaluation of In[1]:= Sin::argx: Sin called with 2 arguments;
1 argument is expected. >>
One can see that the auto-generated Message
inherits the style of the previous printed Cell
. Why this happens? And how to prevent this?
It seems that one workaround for this bug is to move
"Message"
to another place in theCell
options:EDIT
But as the result appearance of the printed
Cell
is changed:EDIT 2
The above workaround works only during the first fresh session. After saving and reopening of the Notebook the problem appears again.
The only working workaround a this moment is do not use Styles but to specify explicit set of options.