Wed, 17 Feb 2010 14:12:29 +0100
Philipp Stephani skrev:
> Am 16.02.2010 um 15:04 schrieb Manuel Pégourié-Gonnard:
>> Such conversion function could also be the place to implement "string input
>> methods" if they are needed. Eg, the most basic conversion function would be
>> something like \edef + \detokenize, but one could imagine a conversion function
>> that locally redefines \% as expanding into a catcode 12 %, etc. before
>> performing the \edef, so that a user can easily input arbitrary strings.
> I have also thought a bit about this, more from a user perspective:
> Users wonder why using \verb or \index inside macros produces weird
> results. So there should probably be a class of functions to define
> \index- and \verb-like commands
This is basically the point of the "harmless character sequence"
datatype I implemented in xdoc2, and which long-time list subscribers
no doubt recall me bringing up about once a year...
> – e.g. with argument specifiers like "s" and "v" in xparse.
Not quite that compact, but the concept of "argument processors" was
added to xparse in part to support this kind of thing.
> The commands thus defined should then receive
> only other tokens and also check for this. In this way misusing of the
> commands can be easily detected, and in this case the command can fall
> back to \detokenize and output a user-friendly error message.
Actually, it turns out to be useful to support some commands in this
kind of material -- in particular, for encoding special characters in a
way that will be harmless in all contexts that the strings will pass
through (for me, it was important that they could pass through makeindex).