[texhax] Macros that define other macros

Uwe Lück uwe.lueck at web.de
Mon Dec 3 15:55:05 CET 2012


Dear Pablo,

Am Montag, den 03.12.2012, 10:46 -0300 schrieb Pablo Mayckon:
> The doubling of the hashes was easy to understand. I also did a quick reading
> about "\csname" in the web and in principle understood how to use it. Later I
> will try to use these techniques and see whether I succeed. In any case, now I
> have a clear indication of what to study.
> 
> Uwe: I really wanted the argument of \macromaker to be used in the names of
> its "submacros". The need for this was perhaps not clear from that
> artificially built example, but I do want to use it in my real context.

doubling hashes is actually wrong for what you have in mind, 
when the outer parameter should be used in the inner definition(s). 
Neal's idea is a better interpretation of your mail, I did not 
properly try to make sense of "this is a submacro" and "this is 
another submacro" (I may be trying again below).

The \csname thing actually is used with "LaTeX objects" such as 
environments, counters, or references having an "identifier" like 
your outer parameter where "properties" of such an object are coded 
by "submacros" perhaps in your sense, each property with its own 
"namespace" encoding it. Heiko Oberdiek has used this "view" and 
terminology in his `zref' package. His `aliascnt' is a package that 
"copies" objects under different identifiers, where the "class" of 
"objects" just is that of "LaTeX counters". 

For one class of objects with three properties, you could define 
an object #1 by a macro \setobject as follows:

\newcommand{\setobject}[4]{%}


Cheers,

    Uwe.




More information about the texhax mailing list