## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

#### View:

 Message: [ First | Previous | Next | Last ] By Topic: [ First | Previous | Next | Last ] By Author: [ First | Previous | Next | Last ] Font: Proportional Font

Subject:

Re: Rescanning first token of environment when no optional argument is given

From:

Mailing list for the LaTeX3 project <[log in to unmask]>

Date:

Mon, 1 Apr 2019 09:29:53 +0200

Content-Type:

multipart/signed

Parts/Attachments:

 text/plain (47 lines) , signature.asc (47 lines)
 Hi, On Sun, 2019-03-31 at 18:57 -0300, Phelype Oleinik wrote: > If you can't switch the catcode of & before looking for the > optional argument, as David suggests David has a good point, I could handle the optional argument parsing myself and ensure that the case works correctly. It may not be trivial, but it should be reasonably easy. It had not occurred to me that I could do that. > you can use the ! argument modifier to disallow a space token before > the first “[”: > \NewDocumentEnvironment { sdapsarray } { !o } Oh, I really like the simplicity of that solution. Thanks to you and David for the suggestions! Benjamin > in which case: > > \begin{sdapsarray} > & b > \end{sdapsarray} > > will work as expected, but: > > \begin{sdapsarray} [] % note the space before the [] > & b > \end{sdapsarray} > > and: > > \begin{sdapsarray} > [] > & b > \end{sdapsarray} > > won't see the optional argument anymore. > > Best, > > Phelype