I can create a text cell with text like this:
CellPrint@Cell[
"this is a function call: f[x,y]",
"Text"
]
This produces:
this is a function call: f[x,y]
But I want f[x,y]
to be in inline math form within the text cell, like below:
Why not create the output you want in a text cell using ctrl+9, and then use the menu command Cell | Show Expression
to see what it looks like? When I do this, I see:
Cell[
TextData[{
"This is a function call ",
Cell[
BoxData[FormBox[RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}], TraditionalForm]],
FormatType->"TraditionalForm"
],
":"
}],
"Text",
CellChangeTimes->{{3.7781587877405243`*^9, 3.778158805740602*^9}}
]
and if you CellPrint
the above you get the desired output.
MakeBoxes
version of the inner Cell
does the generalization to any inline math expression inside a text cell.
$\endgroup$
Commented
Sep 22, 2019 at 19:51