On 31/10/2014 05:44, aparsloe wrote: > A section of code that worked for me in July only partly works now. One > issue that I've noticed is that > > \group_begin: > ... > \DeclareDocumentCommand \test ... > ... > \group_end: > > will not in fact create a document command \test -- I get an "Undefined > control sequence" message when I try to use it in the wider document. > The declaration must be outside the group commands -- at least that is > what my experiments tell me. (But \test is recognised within the group > commands.) Is that correct? And is it new? -- I don't recall meeting > this issue back in July. > > The xparse documentation doesn't seem to mention this issue and perhaps > should. I can understand the documenters assuming that a document-wide > command would only be defined at the highest level, but in my context > (working with instant preview in LyX) it was quite natural to define it > within the \group_begin:, \group_end: commands of another funtion. I've > changed that now which has resolved at least some of the problem. > > Andrew xparse has never created global commands: they are local to TeX groups. This has not changed recently, so I am not sure why you've not noticed it before. The question of dealing with context-dependent commands is still an open one, but at the moment having \DeclareDocumentCommand respect grouping seems to be the most sensible approach. -- Joseph Wright