Angus, If you want to support optional arguments correctly you have to
1/ when parsing the layout files, take note whether the styles have 'OptionalArgs 1' in there. 2/ when parsing a command which does have OptionalAgrs set, then parse the optional argument and place it as an InsetOptArg at the beginning of the paragraph. I think that this will allow to make it work without any explicit mention of the sectionning commands. JMarc