[texhax] Copying xparse macros and environments

Joseph Wright joseph.wright at morningstar2.co.uk
Wed May 30 11:09:09 CEST 2018


On 30/05/2018 09:37, Brian Dunn wrote:
> 
> Hi all,
> 
> There are arguments against adding a way to \let an xparse command:
> https://tex.stackexchange.com/questions/285551/how-to-let-an-xparse-defined-command
> 
> In particular, the internals may be changed at some point.  But if the
> xparse team were the ones to provide a hypothetical \LetDocumentCommand,
> couldn't this command adapt to any changes?
> 
> Also, I came up with a way to copy an xparse command or environment with new
> names.  Any arguments against \let may also apply to creating a copy, so
> perhaps doing as in the following example might not be a good idea.
> Thoughts?
> 
> (As far as "why?", I wish to copy the original to a new name, also
> provide an alternative with yet another name, then redefine the original to
> call either the copy of the original or the alternative, depending on a
> current state. Such fun.)

They main issue is not technical but conceptual.

The aim of xparse is to provide a declarative syntax for defining 
document commands. The moment you start \let'ing them, you loose that 
clarity in the source. Moreover, there are likely very limited cases 
where one wants the same *conceptual* interface under two different names.

Joseph


More information about the texhax mailing list