Note: This may only work in v9 as many notebook programming functions were added there (Cells in particular).
It is quite frustrating that there is almost a nice way to do this, but not quite. The Inline Cells are indeed stored somewhere as Cell objects. So in theory we can manipulate them using SetOptions, rather than rewriting every "proper" (not inline) cell in the notebook. But it is hard to actually get the CellObjects. Of course I would have preferred if there was a simpler answer, but I guess this may still help.
The code below shows you how to get the cell objects semi-programmatically (it is not really robust). But it also shows you how you can get the CellObjects by selecting them and then using SelectedCells
.
The code below makes a new notebook with your textcell with its inline cells and then makes those cells have an orange background.
cnb =
NotebookPut[
Notebook[
List@
Cell[TextData[{Cell[
BoxData[FormBox[
RowBox[{RowBox[{"f", "", RowBox[{"(", "x", ")"}]}], "", "=",
"", RowBox[{"a", "",
FormBox[SubscriptBox["f", "1"], StandardForm], "",
RowBox[{"(", "x", ")"}]}]}], TraditionalForm]],
"DisplayFormula"], ",",
Cell[BoxData[
FormBox[RowBox[{RowBox[{"g", "", RowBox[{"(", "x", ")"}]}],
"", "=", "",
RowBox[{"r", "",
FormBox[SubscriptBox["g", "1"], StandardForm], "",
RowBox[{"(", "x", ")"}]}]}], TraditionalForm]],
"DisplayFormula"], ",",
Cell[BoxData[
FormBox[RowBox[{RowBox[{"h", "", RowBox[{"(", "x", ")"}]}],
"", "=", "",
RowBox[{"s", "",
FormBox[SubscriptBox["h", "1"], StandardForm], "",
RowBox[{"(", "x", ")"}]}]}], TraditionalForm]],
"DisplayFormula"], ","}], "Text"]
]
]
SelectionMove[cnb, Before, Notebook]
SelectionMove[cnb, Next, Cell]
SelectionMove[cnb, Before, CellContents]
SelectionMove[cnb, Next, Character]
cell1 = SelectedCells[cnb];
SelectionMove[cnb, Next, Cell];
cell2 = SelectedCells[cnb];
SelectionMove[cnb, Next, Cell];
cell3 = SelectedCells[cnb];
Now that we have found the inline cells and named them cell1, cell2 and cell3, we can do
SetOptions[# // First, Background -> Orange] & /@ {cell1, cell2,
cell3}
to make the backgrounds orange.
The line SelectionMove[cnb, Before, Notebook]
is not necessary but may be convenient if you want to experiment yourself.
Workflow
I suggest you store references to inline cells. The code above can help you find your inline cells, but it is not robust. The main problem is to get into the first inline cell I guess. In your example, this was easy enough, as we could simply do SelectionMove[cnb, Next, Character]
, as that moved us into the first inline cell. You may want to set the cursor into the first inline cell yourself and then you can probably use the code
Block[{iii = 1},
While[
SelectedCells[cnb] =!= {}
,
inlineCell[iii] = SelectedCells[cnb];
SelectionMove[cnb, Next, Cell];
iii++
]
]
to get all the inline cells in the current "proper cell".