# Table of sections with CellPrint

I am trying to produce a table of sections with each section containing a DynamicModule. My two questions are: (1) How do I produce grouped sections that are folded shut? (2) How do I stop the text in my DynamicModule from having quotes around it?

Here is a toy code for the dynamic module

ClearAll[f];
f[a_] := DynamicModule[{x = 0.5},
Column[{
"Plot " <> ToString[a],
Slider[Dynamic[x]],
Dynamic[
Plot[Sin[a x t], {t, 0, 2 \[Pi]}, AxesLabel -> {"x", "y"}]
]
}]
]


I now do a table to produce the sections

Table[
CellPrint[TextCell["Section " <> ToString[i], "Subsection"]];
CellPrint[f[i]],
{i, 3}];


The output is open cells and extra quotes around the strings. How do I CellPrint folded cells and get rid of the extra quotes"?

• What do you mean by are folded shut? – Kuba May 21 '15 at 11:46
• @Kuba When you double click on the right bracket you open and shut the cells. I call this folding to avoid a clash with the option CellOpen – Hugh May 21 '15 at 12:11
• @Kuba Thank you for solving my question 2. How about solving my question 1? I will certainly accept it if you can do this? – Hugh May 21 '15 at 13:20
• Sorry for delay. I think the answer should fit your needs now. – Kuba May 22 '15 at 6:32

You can use CellGroupData with 1 as the second argument for creation of cell groups where only first cell is open:
Do[NotebookWrite[EvaluationNotebook[],

The quotes around the text are not shown because I have specified the "Output" style for the cells containing DynamicModule (this style sets ShowStringCharacters->False option for Cell).