## 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: xparse and space skipping

From:

Date:

Mon, 16 May 2011 20:31:36 -0400

Content-Type:

text/plain

Parts/Attachments:

 text/plain (54 lines)
 On 5/16/11, Bruno Le Floch <[log in to unmask]> wrote: > By the way, I wasn't really serious about dropping trailing optional > arguments. > >> > \bar{apa} cepa >> > >> > used to have a space, and \bar for some reason in a package needs to >> be >> > extended >> >> On the other hand I don't think that a package author doing this would >> get >> very happy customers > > It seems technically possible for xparse to store the info of whether > it has skipped spaces or not, and put them back in case there was no > optional argument. > > I quite like Frank's key-val + positional idea. However, I'd change it > a little bit by getting rid of the trailing optional arguments part by > delimiting the argument with (for instance) a semicolon. Uses of \\ > could then be > > \\ ; > \\ [3cm] ; > \\ * [3cm] < color=normal, decoration=fancy-flowers > ; > > This combines nicely with an earlier discussion on document > shorthands, noting that every document short-hand should really have a > trailing \Marker; to prevent \TeX; from losing spaces. These > short-hands could then easily be made to accept arguments by putting > them before the marker. Actually, maybe an approach with two types of commands. Firstly, document shorthands, among which \\, \TeX, \item, which may be followed by some optional positional arguments and key-value comma list, ended with ; . Secondly, document commands close to LaTeX2e, which take at least one braced argument, and as much as possible keep optional arguments before the last mandatory one. I guess the only thing in my post above is to say that we can make sure that there are never optional trailing arguments by enforcing the presence of an end-marker. Separate over-the-top idea (but workable): make # active (let to a normal #) so that it works in definitions etc, but within the document (i.e. whenever we are not doing a \DeclareDocumentCommand), define # to stop the look ahead for optional arguments. Then # could also be used to avoid losing spaces: \TeX# would leave the space alone,\newline# and \eTeX# and \LaTeX# users would strive! Ok... That's kind of ugly :(, I'll sleep. Regards, Bruno