I am trying to use CellPrint to print a cell that asks a user to solve an equation. This equation is randomly generated right beforehand, and I would like to have it print in Blue. The whole Cell should be in the "Section" style. Here is my first attempt:
equat = ToString[
Expand[Product[(x - RandomInteger[{-10, 10}]), {i,
3 + RandomInteger[]}]], TraditionalForm];
CellPrint[
Cell[TextData[
RowBox[{StyleBox["Solve the equation "],
StyleBox[equat, FontColor -> Blue]}]], "Section"]];
This does in fact create the cell, and the last part is blue, but it is hindered by the TraditionalForm "markup": I won't put any color here, but the command above gives the output
Solve the equation \!\(TraditionalForm\`\(x\^4 - \(\(73\ x\^2\)\) - \(\(72\ x\)\)\)\)
Is there a simple way to fix this? I have tried using ToBoxes, but then I don't see how to color the output Blue. Any tips or pointers would be much appreciated.
equ = TraditionalForm@ Expand[Product[(x - RandomInteger[{-10, 10}]), {i, 3 + RandomInteger[]}]];CellPrint[ Cell[CellGroupData[{StyleBox["Solve the equation "], BoxData[ToBoxes@equ]}]]]
$\endgroup$equ = TraditionalForm[ Expand[Product[(x - RandomInteger[{-10, 10}]), {i, 3 + RandomInteger[]}]] == HoldForm[0]];
$\endgroup$