Dear List,

say I have three sections in the document:

    \section{foo} ... \section{bar} ... \section{baz} ...

Now I would like to auto generate a heavily customized table of contents like the following text, which cannot be done by the stock \placecontent in general, and put it into the preface:

   This book has 3 sections: foo, bar, and baz.

The text generation should be trivial with lua, but I don't know how such forward reference of section names works. Could anyone help me with it?

Thanks in advance.

Best,
Sylvain