Adding interactive text
You could use a button like this:
Button["Toggle cell below",
SetOptions[NextCell[],
CellOpen -> ! CurrentValue[NextCell[], CellOpen]]]
You can set the option "ShowGroupOpener"
to True
for the first cell of a cell group to add an Opener
to open/close the cell groups. Alternatively, set the option "WholeCellGroupOpener"
to True
to make the whole cell a behave like a toggler button.
You can do this in two ways:
Manually: Right-click the cell bracket and select Properties
to open the
Option Inspector
notebook. ClickCell Options >> Display Options
and change the setting for "ShowGroupOpener"
.
Programatically: In the first cell of the notebook, using some identifying text for the cells to be modified ("comments"
in the example below), execute
SetOptions[NotebookFind[EvaluationNotebook[], "comments", All],
"ShowGroupOpener" -> True]