How do I insert a calculated value into a text cell?
f[x_] := x^3 + x^2 + 1
Row[{"The value of this function at ", 7 , " is ", f[7], "."}]
Or
StringTemplate["The value of this function at `1` is `2`."][7, f[7]]
f[x_] := x^3 + x^2 + 1
Create a text cell containing:
$\qquad$The value of this function at 7 is N[f[7]]
Select N[f[7]] in the cell
- Choose Evaluate in Place from the Evaluation menu or that operation's keyboard shortcut (Cmd+Return on OS X)
To create an actual text cell, as opposed to an output cell containing text, use
f[x_] := x^3 + x^2 + 1
CellPrint[{TextCell[Row[{"The value of this function at ", 7, " is ", f[7], "."}],
{"Text"}]}]
(* The value of this function at 7 is 393. *)